Ignore:
Timestamp:
Dec 30, 2020, 11:52:07 PM (4 years ago)
Author:
chronos
Message:
  • Added: More modules models installation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Setup.php

    r887 r891  
    412412
    413413    $this->Database->query('CREATE TABLE IF NOT EXISTS `'.$this->UpdateManager->VersionTable.'` (
    414   `Id` int(11) NOT NULL AUTO_INCREMENT,
    415   `Revision` int(11) NOT NULL,
    416   PRIMARY KEY (`Id`)
    417 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     414      `Id` int(11) NOT NULL AUTO_INCREMENT,
     415      `Revision` int(11) NOT NULL,
     416      PRIMARY KEY (`Id`)
     417    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    418418    $this->Database->query("INSERT INTO `".$this->UpdateManager->VersionTable."` (`Id`, `Revision`) VALUES
    419419      (1, ".$DatabaseRevision.");");
    420420    $this->Database->query("CREATE TABLE IF NOT EXISTS `Module` (
    421   `Id` int(11) NOT NULL AUTO_INCREMENT,
    422   `Name` varchar(255) NOT NULL,
    423   `Title` varchar(255) NOT NULL,
    424   PRIMARY KEY (`Id`)
    425 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     421      `Id` int(11) NOT NULL AUTO_INCREMENT,
     422      `Name` varchar(255) NOT NULL,
     423      `Title` varchar(255) NOT NULL,
     424      PRIMARY KEY (`Id`)
     425    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     426    $this->Database->query("CREATE TABLE IF NOT EXISTS `ModuleModel` (
     427      `Id` int(11) NOT NULL AUTO_INCREMENT,
     428      `Name` varchar(255) NOT NULL,
     429      `Module` int(11) NOT NULL,
     430      PRIMARY KEY (`Id`)
     431    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     432    $this->Database->query('ALTER TABLE `ModuleModel`
     433      ADD CONSTRAINT `ModuleModel_ibfk_1` FOREIGN KEY (`Module`) REFERENCES `Module` (`Id`);');
     434    $this->Database->query("CREATE TABLE IF NOT EXISTS `ModuleModelProperty` (
     435      `Id` int(11) NOT NULL AUTO_INCREMENT,
     436      `Name` varchar(255) NOT NULL,
     437      `Model` int(11) NOT NULL,
     438      `Type` int(11) NOT NULL,
     439      `Nullable` tinyint(1) NOT NULL,
     440      PRIMARY KEY (`Id`)
     441    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     442    $this->Database->query('ALTER TABLE `ModuleModelProperty`
     443      ADD CONSTRAINT `ModuleModelProperty_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `ModuleModel` (`Id`);');
    426444  }
    427445
     
    429447  {
    430448    $this->System->ModuleManager->UninstallAll();
     449    $this->Database->query('DROP TABLE `ModuleModelProperty`');
     450    $this->Database->query('DROP TABLE `ModuleModel`');
    431451    $this->Database->query('DROP TABLE `Module`');
    432452    $this->Database->query('DROP TABLE `'.$this->UpdateManager->VersionTable.'`');
Note: See TracChangeset for help on using the changeset viewer.