Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

38 lines
1.2KB

  1. /**
  2. * Database schema required by \yii\i18n\DbMessageSource.
  3. *
  4. * @author Dmitry Naumenko <d.naumenko.a@gmail.com>
  5. * @link http://www.yiiframework.com/
  6. * @copyright 2008 Yii Software LLC
  7. * @license http://www.yiiframework.com/license/
  8. * @since 2.0.7
  9. */
  10. drop table if exists "source_message";
  11. drop table if exists "message";
  12. CREATE SEQUENCE source_message_seq;
  13. CREATE TABLE "source_message"
  14. (
  15. "id" integer NOT NULL PRIMARY KEY DEFAULT nextval('source_message_seq'),
  16. "category" varchar(255),
  17. "message" text
  18. );
  19. CREATE TABLE "message"
  20. (
  21. "id" integer NOT NULL,
  22. "language" varchar(16) NOT NULL,
  23. "translation" text
  24. );
  25. ALTER TABLE "message" ADD CONSTRAINT "pk_message_id_language" PRIMARY KEY ("id", "language");
  26. ALTER TABLE "message" ADD CONSTRAINT "fk_message_source_message" FOREIGN KEY ("id") REFERENCES "source_message" ("id") ON UPDATE CASCADE ON DELETE RESTRICT;
  27. CREATE INDEX "idx_message_language" ON "message" USING btree (language);
  28. ALTER TABLE "message" CLUSTER ON "idx_message_language";
  29. CREATE INDEX "idx_source_message_category" ON "source_message" USING btree (category);
  30. ALTER TABLE "source_message" CLUSTER ON "idx_source_message_category";