init
This commit is contained in:
52
vendor/yiisoft/yii2/i18n/migrations/m150207_210500_i18n_init.php
vendored
Normal file
52
vendor/yiisoft/yii2/i18n/migrations/m150207_210500_i18n_init.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Initializes i18n messages tables.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@gmail.com>
|
||||
* @since 2.0.7
|
||||
*/
|
||||
class m150207_210500_i18n_init extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$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('{{%source_message}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'category' => $this->string(),
|
||||
'message' => $this->text(),
|
||||
], $tableOptions);
|
||||
|
||||
$this->createTable('{{%message}}', [
|
||||
'id' => $this->integer()->notNull(),
|
||||
'language' => $this->string(16)->notNull(),
|
||||
'translation' => $this->text(),
|
||||
], $tableOptions);
|
||||
|
||||
$this->addPrimaryKey('pk_message_id_language', '{{%message}}', ['id', 'language']);
|
||||
$this->addForeignKey('fk_message_source_message', '{{%message}}', 'id', '{{%source_message}}', 'id', 'CASCADE', 'RESTRICT');
|
||||
$this->createIndex('idx_source_message_category', '{{%source_message}}', 'category');
|
||||
$this->createIndex('idx_message_language', '{{%message}}', 'language');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dropForeignKey('fk_message_source_message', '{{%message}}');
|
||||
$this->dropTable('{{%message}}');
|
||||
$this->dropTable('{{%source_message}}');
|
||||
}
|
||||
}
|
||||
35
vendor/yiisoft/yii2/i18n/migrations/schema-mssql.sql
vendored
Normal file
35
vendor/yiisoft/yii2/i18n/migrations/schema-mssql.sql
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Database schema required by \yii\i18n\DbMessageSource.
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@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('[source_message]', 'U') is not null
|
||||
drop table [source_message];
|
||||
|
||||
if object_id('[message]', 'U') is not null
|
||||
drop table [message];
|
||||
|
||||
CREATE TABLE [source_message]
|
||||
(
|
||||
[id] integer IDENTITY PRIMARY KEY,
|
||||
[category] varchar(255),
|
||||
[message] text
|
||||
);
|
||||
|
||||
CREATE TABLE [message]
|
||||
(
|
||||
[id] integer NOT NULL,
|
||||
[language] varchar(16) NOT NULL,
|
||||
[translation] text
|
||||
);
|
||||
|
||||
ALTER TABLE [message] ADD CONSTRAINT [pk_message_id_language] PRIMARY KEY ([id], [language]);
|
||||
ALTER TABLE [message] ADD CONSTRAINT [fk_message_source_message] FOREIGN KEY ([id]) REFERENCES [source_message] ([id]) ON UPDATE CASCADE ON DELETE NO ACTION;
|
||||
|
||||
CREATE INDEX [idx_message_language] on [message] ([language]);
|
||||
CREATE INDEX [idx_source_message_category] on [source_message] ([category]);
|
||||
33
vendor/yiisoft/yii2/i18n/migrations/schema-mysql.sql
vendored
Normal file
33
vendor/yiisoft/yii2/i18n/migrations/schema-mysql.sql
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Database schema required by \yii\i18n\DbMessageSource.
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@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 `source_message`;
|
||||
drop table if exists `message`;
|
||||
|
||||
CREATE TABLE `source_message`
|
||||
(
|
||||
`id` integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`category` varchar(255),
|
||||
`message` text
|
||||
);
|
||||
|
||||
CREATE TABLE `message`
|
||||
(
|
||||
`id` integer NOT NULL,
|
||||
`language` varchar(16) NOT NULL,
|
||||
`translation` text
|
||||
);
|
||||
|
||||
ALTER TABLE `message` ADD CONSTRAINT `pk_message_id_language` PRIMARY KEY (`id`, `language`);
|
||||
ALTER TABLE `message` ADD CONSTRAINT `fk_message_source_message` FOREIGN KEY (`id`) REFERENCES `source_message` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
|
||||
CREATE INDEX idx_message_language ON message (language);
|
||||
CREATE INDEX idx_source_message_category ON source_message (category);
|
||||
33
vendor/yiisoft/yii2/i18n/migrations/schema-oci.sql
vendored
Normal file
33
vendor/yiisoft/yii2/i18n/migrations/schema-oci.sql
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Database schema required by \yii\i18n\DbMessageSource.
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@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 "source_message";
|
||||
drop table if exists "message";
|
||||
|
||||
CREATE TABLE "source_message"
|
||||
(
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"category" varchar(255),
|
||||
"message" clob
|
||||
);
|
||||
CREATE SEQUENCE "source_message_SEQ";
|
||||
|
||||
CREATE TABLE "message"
|
||||
(
|
||||
"id" integer NOT NULL,
|
||||
"language" varchar(16) NOT NULL,
|
||||
"translation" clob,
|
||||
primary key ("id", "language"),
|
||||
foreign key ("id") references "source_message" ("id") on delete cascade
|
||||
);
|
||||
|
||||
CREATE INDEX idx_message_language ON "message"("language");
|
||||
CREATE INDEX idx_source_message_category ON "source_message"("category");
|
||||
38
vendor/yiisoft/yii2/i18n/migrations/schema-pgsql.sql
vendored
Normal file
38
vendor/yiisoft/yii2/i18n/migrations/schema-pgsql.sql
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Database schema required by \yii\i18n\DbMessageSource.
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@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 "source_message";
|
||||
drop table if exists "message";
|
||||
|
||||
CREATE SEQUENCE source_message_seq;
|
||||
|
||||
CREATE TABLE "source_message"
|
||||
(
|
||||
"id" integer NOT NULL PRIMARY KEY DEFAULT nextval('source_message_seq'),
|
||||
"category" varchar(255),
|
||||
"message" text
|
||||
);
|
||||
|
||||
CREATE TABLE "message"
|
||||
(
|
||||
"id" integer NOT NULL,
|
||||
"language" varchar(16) NOT NULL,
|
||||
"translation" text
|
||||
);
|
||||
|
||||
ALTER TABLE "message" ADD CONSTRAINT "pk_message_id_language" PRIMARY KEY ("id", "language");
|
||||
ALTER TABLE "message" ADD CONSTRAINT "fk_message_source_message" FOREIGN KEY ("id") REFERENCES "source_message" ("id") ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
|
||||
CREATE INDEX "idx_message_language" ON "message" USING btree (language);
|
||||
ALTER TABLE "message" CLUSTER ON "idx_message_language";
|
||||
|
||||
CREATE INDEX "idx_source_message_category" ON "source_message" USING btree (category);
|
||||
ALTER TABLE "source_message" CLUSTER ON "idx_source_message_category";
|
||||
30
vendor/yiisoft/yii2/i18n/migrations/schema-sqlite.sql
vendored
Normal file
30
vendor/yiisoft/yii2/i18n/migrations/schema-sqlite.sql
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Database schema required by \yii\i18n\DbMessageSource.
|
||||
*
|
||||
* @author Dmitry Naumenko <d.naumenko.a@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 `source_message`;
|
||||
drop table if exists `message`;
|
||||
|
||||
CREATE TABLE `source_message`
|
||||
(
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`category` varchar(255),
|
||||
`message` text
|
||||
);
|
||||
|
||||
CREATE TABLE `message`
|
||||
(
|
||||
`id` integer NOT NULL REFERENCES `source_message` (`id`) ON UPDATE CASCADE ON DELETE NO ACTION,
|
||||
`language` varchar(16) NOT NULL,
|
||||
`translation` text,
|
||||
PRIMARY KEY (`id`, `language`)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_message_language ON message (language);
|
||||
CREATE INDEX idx_source_message_category ON source_message (category);
|
||||
Reference in New Issue
Block a user