Cms.php 639 B

1234567891011121314151617181920212223
  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. `lang` VARCHAR(8) NULL,
  11. `shurl` VARCHAR(255) NOT NULL,
  12. `title` TEXT NOT NULL ,
  13. `content` LONGTEXT NOT NULL,
  14. UNIQUE(`lang`, `shurl`)
  15. )");
  16. if ($result === false)
  17. throw new \Exception(get_class().": ".self::$dbo->errorInfo()[2]);
  18. return true;
  19. }
  20. }