Cms.php 605 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Entity;
  3. class Cms extends ModelBase
  4. {
  5. protected function install()
  6. {
  7. $dbPrefix = $this->getDbPrefix();
  8. $result = self::$dbo->exec("CREATE TABLE IF NOT EXISTS `{$dbPrefix}cms` (
  9. `id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  10. `shurl` VARCHAR(255) NOT NULL,
  11. `controller` VARCHAR(255) NOT NULL,
  12. `order` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  13. UNIQUE(`shurl`)
  14. )");
  15. if ($result === false)
  16. throw new \Exception(get_class().": ".self::$dbo->errorInfo()[2]);
  17. return true;
  18. }
  19. }