mirror of
https://github.com/docmost/docmost.git
synced 2025-11-15 02:41:19 +10:00
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { Kysely, sql } from 'kysely';
|
|
|
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
await db.schema
|
|
.createTable('file_tasks')
|
|
.addColumn('id', 'uuid', (col) =>
|
|
col.primaryKey().defaultTo(sql`gen_uuid_v7()`),
|
|
)
|
|
//type: import or export
|
|
.addColumn('type', 'varchar', (col) => col)
|
|
// source - generic, notion, confluence
|
|
// type or provider?
|
|
.addColumn('source', 'varchar', (col) => col)
|
|
// status (enum: PENDING|PROCESSING|SUCCESS|FAILED),
|
|
.addColumn('status', 'varchar', (col) => col)
|
|
// file name
|
|
// file path
|
|
// file size
|
|
|
|
.addColumn('file_name', 'varchar', (col) => col.notNull())
|
|
.addColumn('file_path', 'varchar', (col) => col.notNull())
|
|
.addColumn('file_size', 'int8', (col) => col)
|
|
.addColumn('file_ext', 'varchar', (col) => col)
|
|
|
|
.addColumn('creator_id', 'uuid', (col) => col.references('users.id'))
|
|
.addColumn('space_id', 'uuid', (col) =>
|
|
col.references('spaces.id').onDelete('cascade'),
|
|
)
|
|
.addColumn('workspace_id', 'uuid', (col) =>
|
|
col.references('workspaces.id').onDelete('cascade').notNull(),
|
|
)
|
|
.addColumn('created_at', 'timestamptz', (col) =>
|
|
col.notNull().defaultTo(sql`now()`),
|
|
)
|
|
.addColumn('updated_at', 'timestamptz', (col) =>
|
|
col.notNull().defaultTo(sql`now()`),
|
|
)
|
|
.addColumn('completed_at', 'timestamptz', (col) => col)
|
|
.addColumn('deleted_at', 'timestamptz', (col) => col)
|
|
.execute();
|
|
}
|
|
|
|
export async function down(db: Kysely<any>): Promise<void> {
|
|
await db.schema.dropTable('file_tasks').execute();
|
|
}
|