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

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Map/Map.php

    r887 r891  
    316316  function DoInstall(): void
    317317  {
    318     $this->System->Database->query("CREATE TABLE IF NOT EXISTS `MapPosition` (
    319   `Id` int(11) NOT NULL AUTO_INCREMENT,
    320   `Name` varchar(255) NOT NULL,
    321   `Pos` varchar(255) NOT NULL,
    322   PRIMARY KEY (`Id`)
    323 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;");
     318    $this->InstallModel(MapPosition::GetDesc());
    324319  }
    325320
    326321  function DoUninstall(): void
    327322  {
    328     $this->Database->query('DROP TABLE `MapPosition`');
    329   }
    330 }
     323    $this->UninstallModel(MapPosition::GetDesc());
     324  }
     325}
     326
     327class MapPosition extends Model
     328{
     329  static function GetDesc(): ModelDesc
     330  {
     331    $Desc = new ModelDesc('MapPosition');
     332    $Desc->AddString('Name');
     333    $Desc->AddString('Pos');
     334    return $Desc;
     335  }
     336}
Note: See TracChangeset for help on using the changeset viewer.