@coko/server
Version:
Reusable server for use by Coko's projects
30 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.down = exports.up = void 0;
const up = async (knex) => {
try {
await knex.schema.createTable('chat_messages', table => {
table.uuid('id').primary();
table
.timestamp('created', { useTz: true })
.notNullable()
.defaultTo(knex.fn.now());
table.timestamp('updated', { useTz: true });
table.uuid('chat_thread_id').references('chat_threads.id').notNullable();
table.uuid('user_id').references('users.id').notNullable();
table.boolean('is_deleted').defaultTo(false);
table.jsonb('mentions').defaultTo([]);
table.text('content').notNullable();
table.text('type').notNullable();
});
}
catch (e) {
throw new Error(`Chat message: Initial: Migration failed! ${e}`);
}
};
exports.up = up;
const down = async (knex) => {
await knex.schema.dropTable('chat_messages');
};
exports.down = down;
//# sourceMappingURL=1627557702-chat-message-init.js.map