IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_groupAccess') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_groupAccess
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_groupIPs') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_groupIPs
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_groups') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_groups
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_userAccess') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_userAccess
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_userIPs') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_userIPs
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id('dbo.ftp_users') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE dbo.ftp_users
GO
CREATE TABLE dbo.ftp_groupAccess (
indexNo smallint NOT NULL,
ftpUserName varchar (50) NOT NULL,
accessRule varchar (200) NOT NULL
)
GO
CREATE TABLE dbo.ftp_groupIPs (
indexNo smallint NOT NULL,
ftpUserName varchar (50) NOT NULL,
accessRule varchar (80) NOT NULL
)
GO
CREATE TABLE dbo.ftp_groups (
id int IDENTITY (1, 1) NOT NULL,
ftpUserName varchar (50) NOT NULL,
accessRule varchar (200) NULL,
notes varchar (255) NULL
)
GO
CREATE TABLE dbo.ftp_userAccess (
indexNo smallint NOT NULL,
ftpUserName varchar (50) NOT NULL,
accessRule varchar (200) NOT NULL
)
GO
CREATE TABLE dbo.ftp_userIPs (
indexNo smallint NOT NULL,
ftpUserName varchar (50) NOT NULL,
accessRule varchar (80) NOT NULL
)
GO
CREATE TABLE dbo.ftp_users (
id int IDENTITY (1, 1) NOT NULL,
ftpUserName varchar (50) NOT NULL,
ftpPassword varchar (50) NOT NULL,
ftpPasswordType tinyint NULL,
changePassword bit NOT NULL,
sKey varchar (50) NOT NULL,
accessRule varchar (200) NULL,
dirHome varchar (200) NOT NULL,
privilege tinyint NULL,
loginMsgFile varchar (80) NULL,
disabled bit NOT NULL,
sessionEncryption bit NOT NULL,
dirHomeLock bit NOT NULL,
hideHidden bit NOT NULL,
alwaysAllowLogin bit NOT NULL,
maxUsersConcurrent smallint NOT NULL,
speedLimitUp int NULL,
speedLimitDown int NULL,
maxUsersLoginPerIP smallint NOT NULL,
timeOutIdle int NULL,
timeOutSession int NULL,
quotaEnable bit NOT NULL,
quotaCurrent bigint NULL,
quotaMax bigint NULL,
ratioType tinyint NULL,
ratioUp smallint NULL,
ratioDown smallint NULL,
ratioCredit float NULL,
expiration smalldatetime NULL,
groups varchar (80) NULL,
notes varchar (255) NOT NULL
)
GO
ALTER TABLE dbo.ftp_groups WITH NOCHECK ADD
CONSTRAINT pk_ftp_groups PRIMARY KEY CLUSTERED (id)
GO
ALTER TABLE dbo.ftp_users WITH NOCHECK ADD
CONSTRAINT pk_ftp_users PRIMARY KEY CLUSTERED (id)
GO
ALTER TABLE dbo.ftp_groupAccess ADD
CONSTRAINT df_ftp_groupAccess_indexNo DEFAULT (2) FOR indexNo
GO
CREATE INDEX ix_ftp_groupAccess__ftpUserName ON
dbo.ftp_groupAccess(ftpUserName, indexNo)
GO
ALTER TABLE dbo.ftp_groupIPs ADD
CONSTRAINT df_ftp_groupIPs_indexNo DEFAULT (2) FOR indexNo
GO
CREATE INDEX ix_ftp_groupIPs__ftpUserName ON
dbo.ftp_groupIPs(ftpUserName, indexNo)
GO
CREATE UNIQUE INDEX ix_ftp_groups__ftpUserName ON
dbo.ftp_groups(ftpUserName)
GO
ALTER TABLE dbo.ftp_userAccess ADD
CONSTRAINT df_ftp_userAccess_indexNo DEFAULT (2) FOR indexNo
GO
CREATE INDEX ix_ftp_userAccess__ftpUserName ON
dbo.ftp_userAccess(ftpUserName, indexNo)
GO
ALTER TABLE dbo.ftp_userIPs ADD
CONSTRAINT df_ftp_userIPs_indexNo DEFAULT (2) FOR indexNo
GO
CREATE INDEX ix_ftp_userIPs__ftpUserName ON
dbo.ftp_userIPs(ftpUserName, indexNo)
GO
ALTER TABLE dbo.ftp_users ADD
CONSTRAINT df_ftp_users_changePassword DEFAULT (1) FOR changePassword,
CONSTRAINT df_ftp_users_sKey DEFAULT ('') FOR sKey,
CONSTRAINT df_ftp_users_disabled DEFAULT (0) FOR disabled,
CONSTRAINT df_ftp_users_sessionEncryption DEFAULT (0) FOR sessionEncryption,
CONSTRAINT df_ftp_users_dirHome DEFAULT ('') FOR dirHome,
CONSTRAINT df_ftp_users_dirHomeLock DEFAULT (1) FOR dirHomeLock,
CONSTRAINT df_ftp_users_hideHidden DEFAULT (1) FOR hideHidden,
CONSTRAINT df_ftp_users_alwaysAllowLogin DEFAULT (0) FOR alwaysAllowLogin,
CONSTRAINT df_ftp_users_maxUsersConcurrent DEFAULT (10) FOR maxUsersConcurrent,
CONSTRAINT df_ftp_users_speedLimitUp DEFAULT ((-1)) FOR speedLimitUp,
CONSTRAINT df_ftp_users_speedLimitDown DEFAULT ((-1)) FOR speedLimitDown,
CONSTRAINT df_ftp_users_maxUsersLoginPerIP DEFAULT (5) FOR maxUsersLoginPerIP,
CONSTRAINT df_ftp_users_timeOutSession DEFAULT ((-1)) FOR timeOutSession,
CONSTRAINT df_ftp_users_quotaEnable DEFAULT (1) FOR quotaEnable,
CONSTRAINT df_ftp_users_quotaCurrent DEFAULT (0) FOR quotaCurrent,
CONSTRAINT df_ftp_users_quotaMax DEFAULT (52428800) FOR quotaMax,
CONSTRAINT df_ftp_users_notes DEFAULT ('') FOR notes
GO
CREATE UNIQUE INDEX ix_ftp_users__ftpUserName ON dbo.ftp_users(ftpUserName)
GO