This commit is contained in:
2020-10-06 14:27:47 +07:00
commit 586be80cf6
16613 changed files with 3274099 additions and 0 deletions

View 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}}');
}
}

View 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]);

View 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);

View 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");

View 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";

View 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);