@@ -30,7 +30,8 @@ type Schema =
30 "fk_author_id" ::: 'ForeignKey '["postRowAuthorId"] "users" '["userId"]] :=>
30 "fk_author_id" ::: 'ForeignKey '["postRowAuthorId"] "users" '["userId"]] :=>
32 "postRowId" ::: 'Def :=> 'NotNull 'PGint8,
32 "postRowId" ::: 'Def :=> 'NotNull 'PGint8,
33− "postRowAuthorId" ::: 'NoDef :=> 'NotNull 'PGint8
33+ "postRowAuthorId" ::: 'NoDef :=> 'NotNull 'PGint8,
34+ "postRowUpdateTime" ::: 'NoDef :=> 'NotNull 'PGtimestamptz
35 "quotes" ::: 'Table (
36 "quotes" ::: 'Table (
@@ -43,14 +44,12 @@ type Schema =
43 "postElements" ::: 'Table (
44 "postElements" ::: 'Table (
45 "fk_post_quote_self_id" ::: 'ForeignKey '["rowElementId"] "posts" '["postRowId"],
46 "fk_post_quote_self_id" ::: 'ForeignKey '["rowElementId"] "posts" '["postRowId"],
46− "fk_post_element_user_id" ::: 'ForeignKey '["rowElementAuthorId"] "users" '["userId"],
47 "fk_post_quote_id" ::: 'ForeignKey '["rowElementQuote"] "quotes" '["quoteRowId"]
47 "fk_post_quote_id" ::: 'ForeignKey '["rowElementQuote"] "quotes" '["quoteRowId"]
49 -- "unique_post_quote" ::: 'Check '["rowElementOrd", "rowElementMarkdown", "rowElementLatex", "rowElementImage", "rowElementQuote", "rowElementAttachment"]
49 -- "unique_post_quote" ::: 'Check '["rowElementOrd", "rowElementMarkdown", "rowElementLatex", "rowElementImage", "rowElementQuote", "rowElementAttachment"]
52 "rowElementId" ::: 'NoDef :=> 'NotNull 'PGint8,
52 "rowElementId" ::: 'NoDef :=> 'NotNull 'PGint8,
53− "rowElementAuthorId" ::: 'NoDef :=> 'NotNull 'PGint8,
54 "rowElementOrd" ::: 'NoDef :=> 'NotNull 'PGint8,
53 "rowElementOrd" ::: 'NoDef :=> 'NotNull 'PGint8,
55 "rowElementMarkdown" ::: 'NoDef :=> 'Null 'PGtext,
54 "rowElementMarkdown" ::: 'NoDef :=> 'Null 'PGtext,
56 "rowElementLatex" ::: 'NoDef :=> 'Null 'PGtext,
55 "rowElementLatex" ::: 'NoDef :=> 'Null 'PGtext,
@@ -61,14 +60,12 @@ type Schema =
61 "quoteElements" ::: 'Table (
60 "quoteElements" ::: 'Table (
63 "fk_quotes_quote_self_id" ::: 'ForeignKey '["rowElementId"] "quotes" '["quoteRowId"],
62 "fk_quotes_quote_self_id" ::: 'ForeignKey '["rowElementId"] "quotes" '["quoteRowId"],
64− "fk_quote_element_user_id" ::: 'ForeignKey '["rowElementAuthorId"] "users" '["userId"],
65 "fk_quote_quote_id" ::: 'ForeignKey '["rowElementQuote"] "quotes" '["quoteRowId"]
63 "fk_quote_quote_id" ::: 'ForeignKey '["rowElementQuote"] "quotes" '["quoteRowId"]
67 -- "unique_quote_quote" ::: 'Check '["rowElementOrd", "rowElementMarkdown", "rowElementLatex", "rowElementImage", "rowElementQuote", "rowElementAttachment"]
65 -- "unique_quote_quote" ::: 'Check '["rowElementOrd", "rowElementMarkdown", "rowElementLatex", "rowElementImage", "rowElementQuote", "rowElementAttachment"]
70 "rowElementId" ::: 'NoDef :=> 'NotNull 'PGint8,
68 "rowElementId" ::: 'NoDef :=> 'NotNull 'PGint8,
71− "rowElementAuthorId" ::: 'NoDef :=> 'NotNull 'PGint8,
72 "rowElementOrd" ::: 'NoDef :=> 'NotNull 'PGint8,
69 "rowElementOrd" ::: 'NoDef :=> 'NotNull 'PGint8,
73 "rowElementMarkdown" ::: 'NoDef :=> 'Null 'PGtext,
70 "rowElementMarkdown" ::: 'NoDef :=> 'Null 'PGtext,
74 "rowElementLatex" ::: 'NoDef :=> 'Null 'PGtext,
71 "rowElementLatex" ::: 'NoDef :=> 'Null 'PGtext,
@@ -101,7 +98,8 @@ createTables = createTable #users (
101 primaryKey #userId `as` #pk_users
98 primaryKey #userId `as` #pk_users
102 ) >>> createTable #posts (
99 ) >>> createTable #posts (
103 serial8 `as` #postRowId :*
100 serial8 `as` #postRowId :*
104− notNullable int8 `as` #postRowAuthorId
101+ notNullable int8 `as` #postRowAuthorId :*
102+ notNullable timestampWithTimeZone `as` #postRowUpdateTime
106 primaryKey #postRowId `as` #pk_posts :*
104 primaryKey #postRowId `as` #pk_posts :*
107 foreignKey #postRowAuthorId #users #userId OnDeleteCascade OnUpdateCascade `as` #fk_author_id
105 foreignKey #postRowAuthorId #users #userId OnDeleteCascade OnUpdateCascade `as` #fk_author_id
@@ -113,7 +111,6 @@ createTables = createTable #users (
113 foreignKey #quoteRowPostId #posts #postRowId OnDeleteCascade OnUpdateCascade `as` #fk_quote_post_id
111 foreignKey #quoteRowPostId #posts #postRowId OnDeleteCascade OnUpdateCascade `as` #fk_quote_post_id
114 ) >>> createTable #postElements (
112 ) >>> createTable #postElements (
115 notNullable int8 `as` #rowElementId :*
113 notNullable int8 `as` #rowElementId :*
116− notNullable int8 `as` #rowElementAuthorId :*
117 notNullable int8 `as` #rowElementOrd :*
114 notNullable int8 `as` #rowElementOrd :*
118 nullable text `as` #rowElementMarkdown :*
115 nullable text `as` #rowElementMarkdown :*
119 nullable text `as` #rowElementLatex :*
116 nullable text `as` #rowElementLatex :*
@@ -122,11 +119,9 @@ createTables = createTable #users (
122 nullable text `as` #rowElementAttachment
119 nullable text `as` #rowElementAttachment
124 foreignKey #rowElementId #posts #postRowId OnDeleteCascade OnUpdateCascade `as` #fk_post_quote_self_id :*
121 foreignKey #rowElementId #posts #postRowId OnDeleteCascade OnUpdateCascade `as` #fk_post_quote_self_id :*
125− foreignKey #rowElementAuthorId #users #userId OnDeleteCascade OnUpdateCascade `as` #fk_post_element_user_id :*
126 foreignKey #rowElementQuote #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_post_quote_id
122 foreignKey #rowElementQuote #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_post_quote_id
127 ) >>> createTable #quoteElements (
123 ) >>> createTable #quoteElements (
128 notNullable int8 `as` #rowElementId :*
124 notNullable int8 `as` #rowElementId :*
129− notNullable int8 `as` #rowElementAuthorId :*
130 notNullable int8 `as` #rowElementOrd :*
125 notNullable int8 `as` #rowElementOrd :*
131 nullable text `as` #rowElementMarkdown :*
126 nullable text `as` #rowElementMarkdown :*
132 nullable text `as` #rowElementLatex :*
127 nullable text `as` #rowElementLatex :*
@@ -135,7 +130,6 @@ createTables = createTable #users (
135 nullable text `as` #rowElementAttachment
130 nullable text `as` #rowElementAttachment
137 foreignKey #rowElementId #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_quotes_quote_self_id :*
132 foreignKey #rowElementId #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_quotes_quote_self_id :*
138− foreignKey #rowElementAuthorId #users #userId OnDeleteCascade OnUpdateCascade `as` #fk_quote_element_user_id :*
139 foreignKey #rowElementQuote #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_quote_quote_id
133 foreignKey #rowElementQuote #quotes #quoteRowId OnDeleteCascade OnUpdateCascade `as` #fk_quote_quote_id
140 -- ) >>> createView #postsView (select (
134 -- ) >>> createView #postsView (select (
141 -- #posts ! #postRowId :*
135 -- #posts ! #postRowId :*