11--
22-- Created by SQL::Translator::Producer::PostgreSQL
3- -- Created on Wed Feb 21 12:51:23 2018
3+ -- Created on Fri Mar 9 17:43:36 2018
44--
55;
66--
@@ -127,7 +127,7 @@ CREATE INDEX "entity_association_idx_entity_id" on "entity_association" ("entity
127127--
128128CREATE TABLE "global_medals " (
129129 " id" serial NOT NULL ,
130- " group_id" character varying ( 255 ) NOT NULL ,
130+ " group_id" integer NOT NULL ,
131131 " threshold" integer NOT NULL ,
132132 " points" integer NOT NULL ,
133133 PRIMARY KEY (" id" )
@@ -152,7 +152,7 @@ CREATE INDEX "leaderboard_sets_idx_leaderboard_id" on "leaderboard_sets" ("leade
152152--
153153CREATE TABLE "org_medals " (
154154 " id" serial NOT NULL ,
155- " group_id" character varying ( 255 ) NOT NULL ,
155+ " group_id" integer NOT NULL ,
156156 " threshold" integer NOT NULL ,
157157 " points" integer NOT NULL ,
158158 PRIMARY KEY (" id" )
@@ -194,6 +194,7 @@ CREATE TABLE "transactions" (
194194 " proof_image" text ,
195195 " submitted_at" timestamp NOT NULL ,
196196 " purchase_time" timestamp NOT NULL ,
197+ " essential" boolean DEFAULT false NOT NULL ,
197198 " distance" numeric (15 ),
198199 PRIMARY KEY (" id" )
199200);
@@ -240,8 +241,8 @@ CREATE INDEX "feedback_idx_user_id" on "feedback" ("user_id");
240241--
241242CREATE TABLE "global_user_medal_progress " (
242243 " id" serial NOT NULL ,
243- " entity_id" character varying ( 255 ) NOT NULL ,
244- " group_id" character varying ( 255 ) NOT NULL ,
244+ " entity_id" integer NOT NULL ,
245+ " group_id" integer NOT NULL ,
245246 " total" integer NOT NULL ,
246247 PRIMARY KEY (" id" )
247248);
@@ -254,8 +255,8 @@ CREATE INDEX "global_user_medal_progress_idx_group_id" on "global_user_medal_pro
254255--
255256CREATE TABLE "global_user_medals " (
256257 " id" serial NOT NULL ,
257- " entity_id" character varying ( 255 ) NOT NULL ,
258- " group_id" character varying ( 255 ) NOT NULL ,
258+ " entity_id" integer NOT NULL ,
259+ " group_id" integer NOT NULL ,
259260 " points" integer NOT NULL ,
260261 " awarded_at" timestamp NOT NULL ,
261262 " threshold" integer NOT NULL ,
@@ -284,8 +285,8 @@ CREATE INDEX "import_lookups_idx_set_id" on "import_lookups" ("set_id");
284285--
285286CREATE TABLE "org_user_medal_progress " (
286287 " id" serial NOT NULL ,
287- " entity_id" character varying ( 255 ) NOT NULL ,
288- " group_id" character varying ( 255 ) NOT NULL ,
288+ " entity_id" integer NOT NULL ,
289+ " group_id" integer NOT NULL ,
289290 " total" integer NOT NULL ,
290291 PRIMARY KEY (" id" )
291292);
@@ -298,8 +299,8 @@ CREATE INDEX "org_user_medal_progress_idx_group_id" on "org_user_medal_progress"
298299--
299300CREATE TABLE "org_user_medals " (
300301 " id" serial NOT NULL ,
301- " entity_id" character varying ( 255 ) NOT NULL ,
302- " group_id" character varying ( 255 ) NOT NULL ,
302+ " entity_id" integer NOT NULL ,
303+ " group_id" integer NOT NULL ,
303304 " points" integer NOT NULL ,
304305 " awarded_at" timestamp NOT NULL ,
305306 " threshold" integer NOT NULL ,
@@ -342,6 +343,27 @@ CREATE TABLE "session_tokens" (
342343);
343344CREATE INDEX "session_tokens_idx_user_id " on " session_tokens" (" user_id" );
344345
346+ ;
347+ --
348+ -- Table: transaction_recurring
349+ --
350+ CREATE TABLE "transaction_recurring " (
351+ " id" serial NOT NULL ,
352+ " buyer_id" integer NOT NULL ,
353+ " seller_id" integer NOT NULL ,
354+ " value" numeric (100 ,0 ) NOT NULL ,
355+ " start_time" timestamp NOT NULL ,
356+ " last_updated" timestamp ,
357+ " essential" boolean DEFAULT false NOT NULL ,
358+ " distance" numeric (15 ),
359+ " category_id" integer ,
360+ " recurring_period" character varying (255 ) NOT NULL ,
361+ PRIMARY KEY (" id" )
362+ );
363+ CREATE INDEX "transaction_recurring_idx_buyer_id " on " transaction_recurring" (" buyer_id" );
364+ CREATE INDEX "transaction_recurring_idx_category_id " on " transaction_recurring" (" category_id" );
365+ CREATE INDEX "transaction_recurring_idx_seller_id " on " transaction_recurring" (" seller_id" );
366+
345367;
346368--
347369-- Table: import_values
@@ -482,6 +504,18 @@ ALTER TABLE "organisation_payroll" ADD CONSTRAINT "organisation_payroll_fk_org_i
482504ALTER TABLE " session_tokens" ADD CONSTRAINT " session_tokens_fk_user_id" FOREIGN KEY (" user_id" )
483505 REFERENCES " users" (" id" ) ON DELETE NO ACTION ON UPDATE NO ACTION;
484506
507+ ;
508+ ALTER TABLE " transaction_recurring" ADD CONSTRAINT " transaction_recurring_fk_buyer_id" FOREIGN KEY (" buyer_id" )
509+ REFERENCES " entities" (" id" ) ON DELETE NO ACTION ON UPDATE NO ACTION;
510+
511+ ;
512+ ALTER TABLE " transaction_recurring" ADD CONSTRAINT " transaction_recurring_fk_category_id" FOREIGN KEY (" category_id" )
513+ REFERENCES " category" (" id" ) DEFERRABLE;
514+
515+ ;
516+ ALTER TABLE " transaction_recurring" ADD CONSTRAINT " transaction_recurring_fk_seller_id" FOREIGN KEY (" seller_id" )
517+ REFERENCES " entities" (" id" ) ON DELETE NO ACTION ON UPDATE NO ACTION;
518+
485519;
486520ALTER TABLE " import_values" ADD CONSTRAINT " import_values_fk_set_id" FOREIGN KEY (" set_id" )
487521 REFERENCES " import_sets" (" id" ) ON DELETE NO ACTION ON UPDATE NO ACTION;
0 commit comments