Added basic comments.

This commit is contained in:
2023-06-11 05:32:02 +02:00
parent 9a9b92a6b1
commit 0d5744e3ff
26 changed files with 441 additions and 89 deletions

View File

@@ -83,7 +83,7 @@ export async function up(knex) {
.notNullable();
table.text('body');
table.text('url');
table.text('link');
table.integer('shelf_id')
.notNullable()
@@ -100,7 +100,7 @@ export async function up(knex) {
.defaultTo(knex.fn.now());
});
await knex.raw('ALTER TABLE posts ADD CONSTRAINT post_content CHECK (body IS NOT NULL OR url IS NOT NULL)');
await knex.raw('ALTER TABLE posts ADD CONSTRAINT post_content CHECK (body IS NOT NULL OR link IS NOT NULL)');
await knex.schema.createTable('comments', (table) => {
table.text('id', 8)
@@ -112,6 +112,10 @@ export async function up(knex) {
.references('id')
.inTable('posts');
table.integer('parent_comment_id')
.references('id')
.inTable('comments');
table.integer('user_id')
.notNullable()
.references('id')