* Fixes
* use lower case db column names * fix signup workspaceId
This commit is contained in:
@@ -9,44 +9,24 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||
.addColumn('content', 'jsonb', (col) => col)
|
||||
.addColumn('selection', 'varchar', (col) => col)
|
||||
.addColumn('type', 'varchar', (col) => col)
|
||||
.addColumn('creatorId', 'uuid', (col) => col.references('users.id'))
|
||||
.addColumn('pageId', 'uuid', (col) =>
|
||||
.addColumn('creator_id', 'uuid', (col) => col.references('users.id'))
|
||||
.addColumn('page_id', 'uuid', (col) =>
|
||||
col.references('pages.id').onDelete('cascade').notNull(),
|
||||
)
|
||||
.addColumn('parentCommentId', 'uuid', (col) =>
|
||||
.addColumn('parent_comment_id', 'uuid', (col) =>
|
||||
col.references('comments.id').onDelete('cascade'),
|
||||
)
|
||||
.addColumn('workspaceId', 'uuid', (col) =>
|
||||
.addColumn('workspace_id', 'uuid', (col) =>
|
||||
col.references('workspaces.id').notNull(),
|
||||
)
|
||||
.addColumn('createdAt', 'timestamp', (col) =>
|
||||
.addColumn('created_at', 'timestamptz', (col) =>
|
||||
col.notNull().defaultTo(sql`now()`),
|
||||
)
|
||||
.addColumn('editedAt', 'timestamp', (col) => col)
|
||||
.addColumn('deletedAt', 'timestamp', (col) => col)
|
||||
.addColumn('edited_at', 'timestamptz', (col) => col)
|
||||
.addColumn('deleted_at', 'timestamptz', (col) => col)
|
||||
.execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
.dropConstraint('comments_creatorId_fkey')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
.dropConstraint('comments_pageId_fkey')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
.dropConstraint('comments_parentCommentId_fkey')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
.dropConstraint('comments_workspaceId_fkey')
|
||||
.execute();
|
||||
|
||||
await db.schema.dropTable('comments').execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user