aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/Resources/IM_Store.migrations
blob: eb97824ea30c7ceeb9504dd622103b543cc3f858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
:VERSION 1         # -------------------------- 

BEGIN Transaction;

Create Sequence im_offiline_id increment by 1 start with 1;

CREATE TABLE im_offline (
  "ID" integer PRIMARY KEY NOT NULL DEFAULT nextval('im_offiline_id') ,
  "PrincipalID" char(36) NOT NULL default '',
  "Message" text NOT NULL,
  "TMStamp" timestamp NOT NULL default now()
);

COMMIT;

:VERSION 2         # -------------------------- 

BEGIN;

/*
INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
DROP TABLE `diva_im_offline`;
DELETE FROM `migrations` WHERE name='diva_im_Store';
*/

COMMIT;

:VERSION 3         # -------------------------- 

BEGIN;

-- dropping the table here as there most likely is only one record in the table at the time of migration

DROP TABLE IF EXISTS "public"."im_offline";
CREATE TABLE "public"."im_offline" (
	"ID" serial,
	"PrincipalID" uuid NOT NULL,
	"Message" text NOT NULL COLLATE "default",
	"TMStamp" timestamp(6) NOT NULL DEFAULT clock_timestamp(),
	"FromID" uuid NOT NULL
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."im_offline" ADD PRIMARY KEY ("ID","PrincipalID","FromID") NOT DEFERRABLE INITIALLY IMMEDIATE;

COMMIT;