Database Migrations

Applied 2023-10-08 20:35:50

create initial database

 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
46
47
48
---- 
--
drop table if exists "item";
--
--
drop table if exists "collection";
--
--
--
--
--
create table if not exists "collection" (
"id" uuid not null,
"name" text not null,
"created" timestamp not null default current_timestamp,
primary key ("id")
);
--
--
create table if not exists "item" (
"id" uuid not null,
"collection_id" uuid not null,
"name" text not null,
"created" timestamp not null default current_timestamp,
foreign key ("collection_id") references "collection" ("id"),
primary key ("id")
);

create index if not exists "item__collection_id_idx" on "item" ("collection_id");
--
--
--
--
insert into "collection" (
"id", "name", "created"
) values (
'10000000-0000-0000-0000-000000000000', 'Test Collection', current_timestamp
) on conflict do nothing;
--
--
insert into "item" (
"id", "collection_id", "name", "created"
) values (
'10000000-0000-0000-0000-000000000001', '10000000-0000-0000-0000-000000000000', 'Test Item', current_timestamp
) on conflict do nothing;
--
--
--