This commit is contained in:
Finn 2018-03-09 17:44:47 +00:00
parent 43f17596fe
commit bc3574561e
88 changed files with 375 additions and 37617 deletions

View file

@ -15,7 +15,7 @@ CREATE UNIQUE INDEX global_medal_group_group_name ON global_medal_group (group_n
;
CREATE TABLE global_medals (
id INTEGER PRIMARY KEY NOT NULL,
group_id varchar(255) NOT NULL,
group_id integer NOT NULL,
threshold integer NOT NULL,
points integer NOT NULL,
FOREIGN KEY (group_id) REFERENCES global_medal_group(id) ON DELETE NO ACTION ON UPDATE NO ACTION
@ -27,8 +27,8 @@ CREATE INDEX global_medals_idx_group_id ON global_medals (group_id);
;
CREATE TABLE global_user_medal_progress (
id INTEGER PRIMARY KEY NOT NULL,
entity_id varchar(255) NOT NULL,
group_id varchar(255) NOT NULL,
entity_id integer NOT NULL,
group_id integer NOT NULL,
total integer NOT NULL,
FOREIGN KEY (entity_id) REFERENCES entities(id),
FOREIGN KEY (group_id) REFERENCES global_medal_group(id) ON DELETE NO ACTION ON UPDATE NO ACTION
@ -43,8 +43,8 @@ CREATE INDEX global_user_medal_progress_idx_group_id ON global_user_medal_progre
;
CREATE TABLE global_user_medals (
id INTEGER PRIMARY KEY NOT NULL,
entity_id varchar(255) NOT NULL,
group_id varchar(255) NOT NULL,
entity_id integer NOT NULL,
group_id integer NOT NULL,
points integer NOT NULL,
awarded_at datetime NOT NULL,
threshold integer NOT NULL,
@ -70,7 +70,7 @@ CREATE UNIQUE INDEX org_medal_group_group_name ON org_medal_group (group_name);
;
CREATE TABLE org_medals (
id INTEGER PRIMARY KEY NOT NULL,
group_id varchar(255) NOT NULL,
group_id integer NOT NULL,
threshold integer NOT NULL,
points integer NOT NULL,
FOREIGN KEY (group_id) REFERENCES org_medal_group(id) ON DELETE NO ACTION ON UPDATE NO ACTION
@ -82,8 +82,8 @@ CREATE INDEX org_medals_idx_group_id ON org_medals (group_id);
;
CREATE TABLE org_user_medal_progress (
id INTEGER PRIMARY KEY NOT NULL,
entity_id varchar(255) NOT NULL,
group_id varchar(255) NOT NULL,
entity_id integer NOT NULL,
group_id integer NOT NULL,
total integer NOT NULL,
FOREIGN KEY (entity_id) REFERENCES entities(id),
FOREIGN KEY (group_id) REFERENCES org_medal_group(id) ON DELETE NO ACTION ON UPDATE NO ACTION
@ -98,8 +98,8 @@ CREATE INDEX org_user_medal_progress_idx_group_id ON org_user_medal_progress (gr
;
CREATE TABLE org_user_medals (
id INTEGER PRIMARY KEY NOT NULL,
entity_id varchar(255) NOT NULL,
group_id varchar(255) NOT NULL,
entity_id integer NOT NULL,
group_id integer NOT NULL,
points integer NOT NULL,
awarded_at datetime NOT NULL,
threshold integer NOT NULL,
@ -113,6 +113,35 @@ 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 INTEGER PRIMARY KEY NOT NULL,
buyer_id integer NOT NULL,
seller_id integer NOT NULL,
value numeric(100,0) NOT NULL,
start_time datetime NOT NULL,
last_updated datetime,
essential boolean NOT NULL DEFAULT false,
distance numeric(15),
category_id integer,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (buyer_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (category_id) REFERENCES category(id),
FOREIGN KEY (seller_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION
);
;
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 transactions ADD COLUMN essential boolean NOT NULL DEFAULT false;
;
COMMIT;

View file

@ -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 NOT NULL DEFAULT false;
;
COMMIT;

View file

@ -1,23 +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 integer NOT NULL,
transaction_id integer NOT NULL,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE
);
;
CREATE INDEX transaction_recurring_idx_transaction_id ON transaction_recurring (transaction_id);
;
CREATE UNIQUE INDEX transaction_recurring_transaction_id ON transaction_recurring (transaction_id);
;
COMMIT;

View file

@ -1,43 +0,0 @@
-- Convert schema 'share/ddl/_source/deploy/25/001-auto.yml' to 'share/ddl/_source/deploy/26/001-auto.yml':;
;
BEGIN;
;
CREATE TEMPORARY TABLE transaction_recurring_temp_alter (
id integer NOT NULL,
transaction_id integer NOT NULL,
recurring_period varchar(255),
FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE
);
;
INSERT INTO transaction_recurring_temp_alter( id, transaction_id, recurring_period) SELECT id, transaction_id, recurring_period FROM transaction_recurring;
;
DROP TABLE transaction_recurring;
;
CREATE TABLE transaction_recurring (
id integer NOT NULL,
transaction_id integer NOT NULL,
recurring_period varchar(255),
FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE
);
;
CREATE INDEX transaction_recurring_idx_t00 ON transaction_recurring (transaction_id);
;
CREATE UNIQUE INDEX transaction_recurring_trans00 ON transaction_recurring (transaction_id);
;
INSERT INTO transaction_recurring SELECT id, transaction_id, recurring_period FROM transaction_recurring_temp_alter;
;
DROP TABLE transaction_recurring_temp_alter;
;
COMMIT;

View file

@ -1,43 +0,0 @@
-- Convert schema 'share/ddl/_source/deploy/26/001-auto.yml' to 'share/ddl/_source/deploy/27/001-auto.yml':;
;
BEGIN;
;
CREATE TEMPORARY TABLE transaction_recurring_temp_alter (
id INTEGER PRIMARY KEY NOT NULL,
transaction_id integer NOT NULL,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE
);
;
INSERT INTO transaction_recurring_temp_alter( id, transaction_id, recurring_period) SELECT id, transaction_id, recurring_period FROM transaction_recurring;
;
DROP TABLE transaction_recurring;
;
CREATE TABLE transaction_recurring (
id INTEGER PRIMARY KEY NOT NULL,
transaction_id integer NOT NULL,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE
);
;
CREATE INDEX transaction_recurring_idx_t00 ON transaction_recurring (transaction_id);
;
CREATE UNIQUE INDEX transaction_recurring_trans00 ON transaction_recurring (transaction_id);
;
INSERT INTO transaction_recurring SELECT id, transaction_id, recurring_period FROM transaction_recurring_temp_alter;
;
DROP TABLE transaction_recurring_temp_alter;
;
COMMIT;

View file

@ -1,55 +0,0 @@
-- Convert schema 'share/ddl/_source/deploy/27/001-auto.yml' to 'share/ddl/_source/deploy/28/001-auto.yml':;
;
BEGIN;
;
CREATE TEMPORARY TABLE transaction_recurring_temp_alter (
id INTEGER PRIMARY KEY NOT NULL,
buyer_id integer NOT NULL,
seller_id integer NOT NULL,
value numeric(100,0) NOT NULL,
start_time datetime NOT NULL,
last_updated datetime NOT NULL,
essential boolean NOT NULL DEFAULT false,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (buyer_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (seller_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION
);
;
INSERT INTO transaction_recurring_temp_alter( id, recurring_period) SELECT id, recurring_period FROM transaction_recurring;
;
DROP TABLE transaction_recurring;
;
CREATE TABLE transaction_recurring (
id INTEGER PRIMARY KEY NOT NULL,
buyer_id integer NOT NULL,
seller_id integer NOT NULL,
value numeric(100,0) NOT NULL,
start_time datetime NOT NULL,
last_updated datetime NOT NULL,
essential boolean NOT NULL DEFAULT false,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (buyer_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (seller_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION
);
;
CREATE INDEX transaction_recurring_idx_b00 ON transaction_recurring (buyer_id);
;
CREATE INDEX transaction_recurring_idx_s00 ON transaction_recurring (seller_id);
;
INSERT INTO transaction_recurring SELECT id, buyer_id, seller_id, value, start_time, last_updated, essential, recurring_period FROM transaction_recurring_temp_alter;
;
DROP TABLE transaction_recurring_temp_alter;
;
COMMIT;

View file

@ -1,17 +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);
;
;
COMMIT;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,64 +0,0 @@
-- Convert schema 'share/ddl/_source/deploy/32/001-auto.yml' to 'share/ddl/_source/deploy/33/001-auto.yml':;
;
BEGIN;
;
CREATE TEMPORARY TABLE transaction_recurring_temp_alter (
id INTEGER PRIMARY KEY NOT NULL,
buyer_id integer NOT NULL,
seller_id integer NOT NULL,
value numeric(100,0) NOT NULL,
start_time datetime NOT NULL,
last_updated datetime,
essential boolean NOT NULL DEFAULT false,
distance numeric(15),
category_id integer,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (buyer_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (category_id) REFERENCES category(id),
FOREIGN KEY (seller_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION
);
;
INSERT INTO transaction_recurring_temp_alter( id, buyer_id, seller_id, value, start_time, last_updated, essential, distance, category_id, recurring_period) SELECT id, buyer_id, seller_id, value, start_time, last_updated, essential, distance, category_id, recurring_period FROM transaction_recurring;
;
DROP TABLE transaction_recurring;
;
CREATE TABLE transaction_recurring (
id INTEGER PRIMARY KEY NOT NULL,
buyer_id integer NOT NULL,
seller_id integer NOT NULL,
value numeric(100,0) NOT NULL,
start_time datetime NOT NULL,
last_updated datetime,
essential boolean NOT NULL DEFAULT false,
distance numeric(15),
category_id integer,
recurring_period varchar(255) NOT NULL,
FOREIGN KEY (buyer_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (category_id) REFERENCES category(id),
FOREIGN KEY (seller_id) REFERENCES entities(id) ON DELETE NO ACTION ON UPDATE NO ACTION
);
;
CREATE INDEX transaction_recurring_idx_b00 ON transaction_recurring (buyer_id);
;
CREATE INDEX transaction_recurring_idx_c00 ON transaction_recurring (category_id);
;
CREATE INDEX transaction_recurring_idx_s00 ON transaction_recurring (seller_id);
;
INSERT INTO transaction_recurring SELECT id, buyer_id, seller_id, value, start_time, last_updated, essential, distance, category_id, recurring_period FROM transaction_recurring_temp_alter;
;
DROP TABLE transaction_recurring_temp_alter;
;
COMMIT;