fix DDL
This commit is contained in:
parent
43f17596fe
commit
bc3574561e
88 changed files with 375 additions and 37617 deletions
|
@ -14,7 +14,7 @@ CREATE TABLE "global_medal_group" (
|
|||
;
|
||||
CREATE TABLE "global_medals" (
|
||||
"id" serial NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"threshold" integer NOT NULL,
|
||||
"points" integer NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
|
@ -24,8 +24,8 @@ CREATE INDEX "global_medals_idx_group_id" on "global_medals" ("group_id");
|
|||
;
|
||||
CREATE TABLE "global_user_medal_progress" (
|
||||
"id" serial NOT NULL,
|
||||
"entity_id" character varying(255) NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"entity_id" integer NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"total" integer NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
@ -35,8 +35,8 @@ CREATE INDEX "global_user_medal_progress_idx_group_id" on "global_user_medal_pro
|
|||
;
|
||||
CREATE TABLE "global_user_medals" (
|
||||
"id" serial NOT NULL,
|
||||
"entity_id" character varying(255) NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"entity_id" integer NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"points" integer NOT NULL,
|
||||
"awarded_at" timestamp NOT NULL,
|
||||
"threshold" integer NOT NULL,
|
||||
|
@ -56,7 +56,7 @@ CREATE TABLE "org_medal_group" (
|
|||
;
|
||||
CREATE TABLE "org_medals" (
|
||||
"id" serial NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"threshold" integer NOT NULL,
|
||||
"points" integer NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
|
@ -66,8 +66,8 @@ CREATE INDEX "org_medals_idx_group_id" on "org_medals" ("group_id");
|
|||
;
|
||||
CREATE TABLE "org_user_medal_progress" (
|
||||
"id" serial NOT NULL,
|
||||
"entity_id" character varying(255) NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"entity_id" integer NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"total" integer NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
@ -77,8 +77,8 @@ CREATE INDEX "org_user_medal_progress_idx_group_id" on "org_user_medal_progress"
|
|||
;
|
||||
CREATE TABLE "org_user_medals" (
|
||||
"id" serial NOT NULL,
|
||||
"entity_id" character varying(255) NOT NULL,
|
||||
"group_id" character varying(255) NOT NULL,
|
||||
"entity_id" integer NOT NULL,
|
||||
"group_id" integer NOT NULL,
|
||||
"points" integer NOT NULL,
|
||||
"awarded_at" timestamp NOT NULL,
|
||||
"threshold" integer NOT NULL,
|
||||
|
@ -87,6 +87,24 @@ CREATE TABLE "org_user_medals" (
|
|||
CREATE INDEX "org_user_medals_idx_entity_id" on "org_user_medals" ("entity_id");
|
||||
CREATE INDEX "org_user_medals_idx_group_id" on "org_user_medals" ("group_id");
|
||||
|
||||
;
|
||||
CREATE TABLE "transaction_recurring" (
|
||||
"id" serial NOT NULL,
|
||||
"buyer_id" integer NOT NULL,
|
||||
"seller_id" integer NOT NULL,
|
||||
"value" numeric(100,0) NOT NULL,
|
||||
"start_time" timestamp NOT NULL,
|
||||
"last_updated" timestamp,
|
||||
"essential" boolean DEFAULT false NOT NULL,
|
||||
"distance" numeric(15),
|
||||
"category_id" integer,
|
||||
"recurring_period" character varying(255) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE INDEX "transaction_recurring_idx_buyer_id" on "transaction_recurring" ("buyer_id");
|
||||
CREATE INDEX "transaction_recurring_idx_category_id" on "transaction_recurring" ("category_id");
|
||||
CREATE INDEX "transaction_recurring_idx_seller_id" on "transaction_recurring" ("seller_id");
|
||||
|
||||
;
|
||||
ALTER TABLE "global_medals" ADD CONSTRAINT "global_medals_fk_group_id" FOREIGN KEY ("group_id")
|
||||
REFERENCES "global_medal_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
@ -127,6 +145,21 @@ ALTER TABLE "org_user_medals" ADD CONSTRAINT "org_user_medals_fk_entity_id" FORE
|
|||
ALTER TABLE "org_user_medals" ADD CONSTRAINT "org_user_medals_fk_group_id" FOREIGN KEY ("group_id")
|
||||
REFERENCES "org_medal_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
;
|
||||
ALTER TABLE "transaction_recurring" ADD CONSTRAINT "transaction_recurring_fk_buyer_id" FOREIGN KEY ("buyer_id")
|
||||
REFERENCES "entities" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
;
|
||||
ALTER TABLE "transaction_recurring" ADD CONSTRAINT "transaction_recurring_fk_category_id" FOREIGN KEY ("category_id")
|
||||
REFERENCES "category" ("id") DEFERRABLE;
|
||||
|
||||
;
|
||||
ALTER TABLE "transaction_recurring" ADD CONSTRAINT "transaction_recurring_fk_seller_id" FOREIGN KEY ("seller_id")
|
||||
REFERENCES "entities" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
;
|
||||
ALTER TABLE transactions ADD COLUMN essential boolean DEFAULT false NOT NULL;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/23/001-auto.yml' to 'share/ddl/_source/deploy/24/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transactions ADD COLUMN essential boolean DEFAULT false NOT NULL;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/24/001-auto.yml' to 'share/ddl/_source/deploy/25/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
CREATE TABLE "transaction_recurring" (
|
||||
"id" serial NOT NULL,
|
||||
"transaction_id" integer NOT NULL,
|
||||
"recurring_period" character varying(255) NOT NULL,
|
||||
CONSTRAINT "transaction_recurring_transaction_id" UNIQUE ("transaction_id")
|
||||
);
|
||||
CREATE INDEX "transaction_recurring_idx_transaction_id" on "transaction_recurring" ("transaction_id");
|
||||
|
||||
;
|
||||
ALTER TABLE "transaction_recurring" ADD CONSTRAINT "transaction_recurring_fk_transaction_id" FOREIGN KEY ("transaction_id")
|
||||
REFERENCES "transactions" ("id") ON DELETE CASCADE DEFERRABLE;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/25/001-auto.yml' to 'share/ddl/_source/deploy/26/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ALTER COLUMN recurring_period DROP NOT NULL;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/26/001-auto.yml' to 'share/ddl/_source/deploy/27/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ALTER COLUMN recurring_period SET NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD PRIMARY KEY (id);
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/27/001-auto.yml' to 'share/ddl/_source/deploy/28/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring DROP CONSTRAINT transaction_recurring_transaction_id;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring DROP CONSTRAINT transaction_recurring_fk_transaction_id;
|
||||
|
||||
;
|
||||
DROP INDEX transaction_recurring_idx_transaction_id;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring DROP COLUMN transaction_id;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN buyer_id integer NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN seller_id integer NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN value numeric(100,0) NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN start_time timestamp NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN last_updated timestamp NOT NULL;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN essential boolean DEFAULT false NOT NULL;
|
||||
|
||||
;
|
||||
CREATE INDEX transaction_recurring_idx_buyer_id on transaction_recurring (buyer_id);
|
||||
|
||||
;
|
||||
CREATE INDEX transaction_recurring_idx_seller_id on transaction_recurring (seller_id);
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD CONSTRAINT transaction_recurring_fk_buyer_id FOREIGN KEY (buyer_id)
|
||||
REFERENCES entities (id) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD CONSTRAINT transaction_recurring_fk_seller_id FOREIGN KEY (seller_id)
|
||||
REFERENCES entities (id) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/28/001-auto.yml' to 'share/ddl/_source/deploy/29/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN category_id integer;
|
||||
|
||||
;
|
||||
CREATE INDEX transaction_recurring_idx_category_id on transaction_recurring (category_id);
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD CONSTRAINT transaction_recurring_fk_category_id FOREIGN KEY (category_id)
|
||||
REFERENCES category (id) DEFERRABLE;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/29/001-auto.yml' to 'share/ddl/_source/deploy/30/001-auto.yml':;
|
||||
|
||||
;
|
||||
-- No differences found;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/30/001-auto.yml' to 'share/ddl/_source/deploy/31/001-auto.yml':;
|
||||
|
||||
;
|
||||
-- No differences found;
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/31/001-auto.yml' to 'share/ddl/_source/deploy/32/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ADD COLUMN distance numeric(15);
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/32/001-auto.yml' to 'share/ddl/_source/deploy/33/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
ALTER TABLE transaction_recurring ALTER COLUMN last_updated DROP NOT NULL;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
Reference in a new issue