Changeset 103 for trunk/Modules/User/UModuleUser.pas
- Timestamp:
- Oct 8, 2012, 8:48:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/UModuleUser.pas
r97 r103 80 80 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 81 81 82 Data.Add('Id', '1');83 Data.Add('Name', 'anonymous');84 Data.Add('FullName', 'Anonymous');85 Data.Add('RegistrationTime', 'NOW()');86 Data.Add('Password', '');87 Data.Add('Salt', '');88 Data.Add('Email', '');89 Core.CommonDatabase.Insert('User', Data);90 91 82 Core.CommonDatabase.Query(DbRows, 92 83 'CREATE TABLE IF NOT EXISTS `UserOnline` (' + … … 102 93 ' KEY `User` (`User`)' + 103 94 ') ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 95 96 Core.CommonDatabase.Query(DbRows, 97 'CREATE TABLE IF NOT EXISTS `PermissionGroup` (' + 98 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 99 ' `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT "",' + 100 ' PRIMARY KEY (`Id`)' + 101 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 102 103 Core.CommonDatabase.Query(DbRows, 104 'CREATE TABLE IF NOT EXISTS `PermissionGroupAssignment` (' + 105 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 106 ' `Group` int(11) NOT NULL DEFAULT "0",' + 107 ' `AssignedGroup` int(11) DEFAULT NULL,' + 108 ' `AssignedOperation` int(11) DEFAULT NULL,' + 109 ' PRIMARY KEY (`Id`),' + 110 ' KEY `Group` (`Group`),' + 111 ' KEY `AssignedGroup` (`AssignedGroup`),' + 112 ' KEY `AssignedOperation` (`AssignedOperation`)' + 113 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 114 115 Core.CommonDatabase.Query(DbRows, 116 'CREATE TABLE IF NOT EXISTS `PermissionOperation` (' + 117 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 118 ' `Module` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT "",' + 119 ' `Operation` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT "",' + 120 ' `Item` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT "",' + 121 ' `ItemId` int(11) NOT NULL DEFAULT "0",' + 122 ' PRIMARY KEY (`Id`),' + 123 ' KEY `Module` (`Module`),' + 124 ' KEY `Operation` (`Operation`),' + 125 ' KEY `Item` (`Item`),' + 126 ' KEY `ItemId` (`ItemId`)' + 127 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 128 129 Core.CommonDatabase.Query(DbRows, 130 ' CREATE TABLE IF NOT EXISTS `PermissionUserAssignment` (' + 131 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 132 ' `User` int(11) NOT NULL DEFAULT "0",' + 133 ' `AssignedGroup` int(11) DEFAULT NULL,' + 134 ' `AssignedOperation` int(11) DEFAULT NULL,' + 135 ' PRIMARY KEY (`Id`),' + 136 ' KEY `User` (`User`),' + 137 ' KEY `AssignedGroup` (`AssignedGroup`),' + 138 ' KEY `AssignedOperation` (`AssignedOperation`)' + 139 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 140 141 Core.CommonDatabase.Query(DbRows, 142 'ALTER TABLE `PermissionGroupAssignment`' + 143 ' ADD CONSTRAINT `PermissionGroupAssignment_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `permissiongroup` (`Id`),' + 144 ' ADD CONSTRAINT `PermissionGroupAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `permissiongroup` (`Id`),' + 145 ' ADD CONSTRAINT `PermissionGroupAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `permissionoperation` (`Id`);'); 146 147 Core.CommonDatabase.Query(DbRows, 148 'ALTER TABLE `PermissionUserAssignment`' + 149 ' ADD CONSTRAINT `PermissionUserAssignment_ibfk_1` FOREIGN KEY (`User`) REFERENCES `user` (`Id`),' + 150 ' ADD CONSTRAINT `PermissionUserAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `permissiongroup` (`Id`),' + 151 ' ADD CONSTRAINT `PermissionUserAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `permissionoperation` (`Id`);'); 152 153 104 154 finally 105 155 Data.Free; … … 116 166 try 117 167 DbRows := TDbRows.Create; 168 169 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `PermissionUserAssignment`'); 170 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `PermissionGroupAssignment`'); 171 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `PermissionGroup`'); 172 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `PermissionOperation`'); 118 173 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `User`'); 119 174 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `UserOnline`');
Note:
See TracChangeset
for help on using the changeset viewer.