@@ -6,10 +6,30 @@ example of a table that could be created after setup complete
6
6
- uncomment the statements below
7
7
- save the file and graphile-migrate will update the schema into database automagically
8
8
- any "drop" statements should be at the top (in reverse order)
9
+ reverse order as we could have references
10
+ from the second created table to the first created table
11
+
12
+ here is an pseudo example:
13
+ DROP C;
14
+ DROP B;
15
+ DROP A;
16
+ CREATE A;
17
+ CREATE B;
18
+ CREATE C;
19
+
20
+ if references exists from B -> A
21
+ we have to DROP B before DROP A we have references that point to A from B
22
+
23
+ In the example below post and feed need to be
24
+ deleted in reverse order due to feed -> post
9
25
*/
10
26
11
- -- drop table if exists feed;
12
- -- drop table if exists post;
27
+ -- UNCOMMENT FROM HERE --
28
+
29
+ -- drop table if exists app_public.feed;
30
+ -- drop table if exists app_public.post;
31
+
32
+ -- drop type if exists app_public.post_topic;
13
33
14
34
-- create type app_public.post_topic as enum (
15
35
-- 'discussion',
@@ -18,7 +38,7 @@ example of a table that could be created after setup complete
18
38
-- 'showcase'
19
39
-- );
20
40
21
- -- create table if not exists app_public.post (
41
+ -- create table app_public.post (
22
42
-- id serial primary key,
23
43
-- author_id integer not null references app_public.users(id),
24
44
-- headline text not null check (char_length(headline) < 280),
@@ -35,7 +55,7 @@ example of a table that could be created after setup complete
35
55
-- comment on column app_public.post.body is 'the main body text of our post.';
36
56
-- comment on column app_public.post.created_at is 'the time this post was created.';
37
57
38
- -- create table if not exists app_public.feed (
58
+ -- create table app_public.feed (
39
59
-- id serial primary key,
40
60
-- posts integer not null references app_public.post(id),
41
61
-- created_at timestamp default now()
0 commit comments