Changeset 373 for trunk/Common/Model.php
- Timestamp:
- Jan 19, 2012, 9:43:36 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Model.php
r370 r373 147 147 function Install() 148 148 { 149 $this->Database->insert('SystemModel', array('Name' => $this->Name, 'Module' => $this->Module->Id)); 150 $this->Id = $this->Database->insert_id; 151 149 152 $Query = 'CREATE TABLE IF NOT EXISTS `'.$this->Name.'` ('. 150 153 '`Id` int(11) NOT NULL AUTO_INCREMENT,'; 151 154 foreach($this->Properties as $Property) 152 155 { 156 $this->Database->insert('SystemModelProperty', array('Name' => $Property['Name'], 157 'Model' => $this->Id, 'Type' => $Property['Type'])); 153 158 if($Property['Type'] == PropertyDateTime) 154 159 $Query .= '`'.$Property['Name'].'` DATETIME NOT NULL,'; … … 159 164 else if($Property['Type'] == PropertyString) 160 165 $Query .= '`'.$Property['Name'].'` VARCHAR(255) COLLATE utf8_general_ci NOT NULL,'; 161 else if($Property['Type'] == PropertyText) 166 else if($Property['Type'] == PropertyText8) 167 $Query .= '`'.$Property['Name'].'` TINYTEXT COLLATE utf8_general_ci NOT NULL,'; 168 else if($Property['Type'] == PropertyText16) 162 169 $Query .= '`'.$Property['Name'].'` TEXT COLLATE utf8_general_ci NOT NULL,'; 163 else if($Property['Type'] == PropertyInteger) 170 else if($Property['Type'] == PropertyText24) 171 $Query .= '`'.$Property['Name'].'` MEDIUMTEXT COLLATE utf8_general_ci NOT NULL,'; 172 else if($Property['Type'] == PropertyText32) 173 $Query .= '`'.$Property['Name'].'` LONGTEXT COLLATE utf8_general_ci NOT NULL,'; 174 else if($Property['Type'] == PropertyInteger8) 175 $Query .= '`'.$Property['Name'].'` TINYINT(4) NOT NULL,'; 176 else if($Property['Type'] == PropertyInteger16) 177 $Query .= '`'.$Property['Name'].'` SMALLINT(6) NOT NULL,'; 178 else if($Property['Type'] == PropertyInteger24) 179 $Query .= '`'.$Property['Name'].'` MEDIUMINT(9) NOT NULL,'; 180 else if($Property['Type'] == PropertyInteger32) 164 181 $Query .= '`'.$Property['Name'].'` INT(11) NOT NULL,'; 182 else if($Property['Type'] == PropertyInteger64) 183 $Query .= '`'.$Property['Name'].'` BIGINT(20) NOT NULL,'; 165 184 else if($Property['Type'] == PropertyBoolean) 166 $Query .= '`'.$Property['Name'].'` INT(11)NOT NULL,';185 $Query .= '`'.$Property['Name'].'` BOOLEAN NOT NULL,'; 167 186 else if($Property['Type'] == PropertyFloat) 168 187 $Query .= '`'.$Property['Name'].'` FLOAT NOT NULL,'; 188 else if($Property['Type'] == PropertyDouble) 189 $Query .= '`'.$Property['Name'].'` DOUBLE NOT NULL,'; 169 190 else if($Property['Type'] == PropertyOneToMany) 170 191 $Query .= '`'.$Property['Name'].'` INT(255) NOT NULL,'.
Note:
See TracChangeset
for help on using the changeset viewer.