PHP Method Schema::tableExists, someline-starter Code Examples

This page contains top rated real world PHP examples of method Schema::tableExists from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: Make.php Project: houdunwang/hdcms
0
 public function __construct()
 {
     //创建migration表用于记录动作
     if (!Schema::tableExists('migrations')) {
         $sql = "CREATE TABLE " . c('database.prefix') . 'migrations(migration varchar(255) not null,batch int)CHARSET UTF8';
         Db::execute($sql);
     }
     if (empty(self::$batch)) {
         self::$batch = Db::table('migrations')->max('batch') ?: 0;
     }
 }
Example #2
Show file File: Table.php Project: houdunwang/hdphp
0
    public function cache()
    {
        $table = c('database.prefix') . c('cache.mysql.table');
        if (Schema::tableExists(c('cache.mysql.table'))) {
            $this->error('Table already exists');
        }
        $sql = <<<sql
CREATE TABLE `{$table}` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` char(20) DEFAULT NULL,
  `data` mediumtext,
  `create_at` int(10),
  `expire` int(10),
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
sql;
        Schema::sql($sql);
    }