init
This commit is contained in:
66
vendor/yiisoft/yii2/caching/migrations/m150909_153426_cache_init.php
vendored
Normal file
66
vendor/yiisoft/yii2/caching/migrations/m150909_153426_cache_init.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\caching\DbCache;
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Initializes Cache tables.
|
||||
*
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @since 2.0.7
|
||||
*/
|
||||
class m150909_153426_cache_init extends Migration
|
||||
{
|
||||
/**
|
||||
* @throws yii\base\InvalidConfigException
|
||||
* @return DbCache
|
||||
*/
|
||||
protected function getCache()
|
||||
{
|
||||
$cache = Yii::$app->getCache();
|
||||
if (!$cache instanceof DbCache) {
|
||||
throw new InvalidConfigException('You should configure "cache" component to use database before executing this migration.');
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
$this->db = $cache->db;
|
||||
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable($cache->cacheTable, [
|
||||
'id' => $this->string(128)->notNull(),
|
||||
'expire' => $this->integer(),
|
||||
'data' => $this->binary(),
|
||||
'PRIMARY KEY ([[id]])',
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
$this->db = $cache->db;
|
||||
|
||||
$this->dropTable($cache->cacheTable);
|
||||
}
|
||||
}
|
||||
22
vendor/yiisoft/yii2/caching/migrations/schema-mssql.sql
vendored
Normal file
22
vendor/yiisoft/yii2/caching/migrations/schema-mssql.sql
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Database schema required by \yii\caching\DbCache.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
* @since 2.0.7
|
||||
*/
|
||||
if object_id('[cache]', 'U') is not null
|
||||
drop table [cache];
|
||||
|
||||
drop table if exists [cache];
|
||||
|
||||
create table [cache]
|
||||
(
|
||||
[id] varchar(128) not null,
|
||||
[expire] integer,
|
||||
[data] BLOB,
|
||||
primary key ([id])
|
||||
);
|
||||
20
vendor/yiisoft/yii2/caching/migrations/schema-mysql.sql
vendored
Normal file
20
vendor/yiisoft/yii2/caching/migrations/schema-mysql.sql
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Database schema required by \yii\caching\DbCache.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
* @since 2.0.7
|
||||
*/
|
||||
|
||||
drop table if exists `cache`;
|
||||
|
||||
create table `cache`
|
||||
(
|
||||
`id` varchar(128) not null,
|
||||
`expire` integer,
|
||||
`data` LONGBLOB,
|
||||
primary key (`id`)
|
||||
) engine InnoDB;
|
||||
20
vendor/yiisoft/yii2/caching/migrations/schema-oci.sql
vendored
Normal file
20
vendor/yiisoft/yii2/caching/migrations/schema-oci.sql
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Database schema required by \yii\caching\DbCache.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
* @since 2.0.7
|
||||
*/
|
||||
|
||||
drop table if exists "cache";
|
||||
|
||||
create table "cache"
|
||||
(
|
||||
"id" varchar(128) not null,
|
||||
"expire" integer,
|
||||
"data" BYTEA,
|
||||
primary key ("id")
|
||||
);
|
||||
20
vendor/yiisoft/yii2/caching/migrations/schema-pgsql.sql
vendored
Normal file
20
vendor/yiisoft/yii2/caching/migrations/schema-pgsql.sql
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Database schema required by \yii\caching\DbCache.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
* @since 2.0.7
|
||||
*/
|
||||
|
||||
drop table if exists "cache";
|
||||
|
||||
create table "cache"
|
||||
(
|
||||
"id" varchar(128) not null,
|
||||
"expire" integer,
|
||||
"data" bytea,
|
||||
primary key ("id")
|
||||
);
|
||||
20
vendor/yiisoft/yii2/caching/migrations/schema-sqlite.sql
vendored
Normal file
20
vendor/yiisoft/yii2/caching/migrations/schema-sqlite.sql
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Database schema required by \yii\caching\DbCache.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
* @since 2.0.7
|
||||
*/
|
||||
|
||||
drop table if exists "cache";
|
||||
|
||||
create table "cache"
|
||||
(
|
||||
"id" varchar(128) not null,
|
||||
"expire" integer,
|
||||
"data" BLOB,
|
||||
primary key ("id")
|
||||
);
|
||||
Reference in New Issue
Block a user