Skip to content

Commit e17d91c

Browse files
committed
wip: continuos thread logic and functionality.
1 parent d72a578 commit e17d91c

File tree

27 files changed

+275
-80
lines changed

27 files changed

+275
-80
lines changed

apps/hasura/metadata/databases/masterbots/tables/public_thread.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ object_relationships:
88
- name: modelsEnum
99
using:
1010
foreign_key_constraint_on: model
11+
- name: thread
12+
using:
13+
foreign_key_constraint_on: parent_thread_id
1114
- name: user
1215
using:
1316
foreign_key_constraint_on: user_id
@@ -19,6 +22,13 @@ array_relationships:
1922
table:
2023
name: message
2124
schema: public
25+
- name: threads
26+
using:
27+
foreign_key_constraint_on:
28+
column: parent_thread_id
29+
table:
30+
name: thread
31+
schema: public
2232
insert_permissions:
2333
- role: moderator
2434
permission:
@@ -36,9 +46,7 @@ insert_permissions:
3646
comment: ""
3747
- role: user
3848
permission:
39-
check:
40-
user_id:
41-
_eq: X-Hasura-User-Id
49+
check: {}
4250
columns:
4351
- chatbot_id
4452
- thread_id
@@ -104,10 +112,8 @@ update_permissions:
104112
- chatbot_id
105113
- is_public
106114
- model
107-
filter:
108-
user_id:
109-
_eq: X-Hasura-User-Id
110-
check: null
115+
filter: {}
116+
check: {}
111117
comment: ""
112118
delete_permissions:
113119
- role: moderator
@@ -116,7 +122,5 @@ delete_permissions:
116122
comment: ""
117123
- role: user
118124
permission:
119-
filter:
120-
user_id:
121-
_eq: X-Hasura-User-Id
125+
filter: {}
122126
comment: ""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Could not auto-generate a down migration.
2+
-- Please write an appropriate down migration for the SQL below:
3+
-- alter table "public"."thread" add column "parent_thread" uuid
4+
-- null;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
alter table "public"."thread" add column "parent_thread" uuid
2+
null;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_fkey";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread"
2+
add constraint "thread_parent_thread_fkey"
3+
foreign key ("parent_thread")
4+
references "public"."thread"
5+
("thread_id") on update restrict on delete restrict;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_fkey",
2+
add constraint "thread_parent_thread_fkey"
3+
foreign key ("parent_thread")
4+
references "public"."thread"
5+
("thread_id") on update restrict on delete restrict;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_fkey",
2+
add constraint "thread_parent_thread_fkey"
3+
foreign key ("parent_thread")
4+
references "public"."thread"
5+
("thread_id") on update no action on delete no action;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread"
2+
add constraint "thread_parent_thread_fkey"
3+
foreign key ("parent_thread")
4+
references "public"."thread"
5+
("thread_id") on update no action on delete no action;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_fkey";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
alter table "public"."thread" alter column "parent_thread" drop not null;
2+
alter table "public"."thread" add column "parent_thread" uuid;

0 commit comments

Comments
 (0)