IM_Store.migrations 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. :VERSION 1 # --------------------------
  2. BEGIN Transaction;
  3. Create Sequence im_offiline_id increment by 1 start with 1;
  4. CREATE TABLE im_offline (
  5. "ID" integer PRIMARY KEY NOT NULL DEFAULT nextval('im_offiline_id') ,
  6. "PrincipalID" char(36) NOT NULL default '',
  7. "Message" text NOT NULL,
  8. "TMStamp" timestamp NOT NULL default now()
  9. );
  10. COMMIT;
  11. :VERSION 2 # --------------------------
  12. BEGIN;
  13. /*
  14. INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
  15. DROP TABLE `diva_im_offline`;
  16. DELETE FROM `migrations` WHERE name='diva_im_Store';
  17. */
  18. COMMIT;
  19. :VERSION 3 # --------------------------
  20. BEGIN;
  21. -- dropping the table here as there most likely is only one record in the table at the time of migration
  22. DROP TABLE IF EXISTS "public"."im_offline";
  23. CREATE TABLE "public"."im_offline" (
  24. "ID" serial,
  25. "PrincipalID" uuid NOT NULL,
  26. "Message" text NOT NULL COLLATE "default",
  27. "TMStamp" timestamp(6) NOT NULL DEFAULT clock_timestamp(),
  28. "FromID" uuid NOT NULL
  29. )
  30. WITH (OIDS=FALSE);
  31. ALTER TABLE "public"."im_offline" ADD PRIMARY KEY ("ID","PrincipalID","FromID") NOT DEFERRABLE INITIALLY IMMEDIATE;
  32. COMMIT;