|
1 | | -import { Knex } from "knex"; |
2 | | - |
| 1 | +import { Knex } from 'knex' |
3 | 2 |
|
4 | 3 | export async function up(knex: Knex): Promise<void> { |
| 4 | + await knex.schema.raw('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"') |
| 5 | + |
5 | 6 | await knex.schema.createTable('chatMessages', (table) => { |
6 | | - table.uuid('id').primary().defaultTo(knex.raw('uuid_generate_v4()')); |
7 | | - table.string('message').notNullable(); |
8 | | - table.uuid('agentId').unsigned().notNullable(); |
9 | | - table.foreign('agentId').references('id').inTable('agents'); |
10 | | - table.string('sender').notNullable(); |
11 | | - table.string('connector').notNullable(); |
12 | | - table.string('content').notNullable(); |
13 | | - table.string('coversation_id').notNullable(); |
14 | | - table.timestamps(true, true); |
| 7 | + table.uuid('id').primary().defaultTo(knex.raw('uuid_generate_v4()')) |
| 8 | + table.uuid('agentId').unsigned().notNullable() |
| 9 | + table.foreign('agentId').references('id').inTable('agents') |
| 10 | + table.string('sender').notNullable() |
| 11 | + table.string('connector').notNullable() |
| 12 | + table.string('content').notNullable() |
| 13 | + table.string('coversation_id') |
| 14 | + table.timestamps(true, true) |
15 | 15 | }) |
16 | 16 | } |
17 | 17 |
|
18 | | - |
19 | 18 | export async function down(knex: Knex): Promise<void> { |
20 | | - await knex.schema.dropTable('chatMessages'); |
| 19 | + await knex.schema.dropTable('chatMessages') |
| 20 | + await knex.schema.raw('DROP EXTENSION IF EXISTS "uuid-ossp"') |
21 | 21 | } |
22 | | - |
0 commit comments