Files
plainidx/packages/plaindb/src/documents/migrations/migrations.ts
Morten Olsen ede2d56b7c init
2024-12-10 20:59:29 +01:00

25 lines
668 B
TypeScript

import { DatabaseMigration } from '../../databases/databases.js';
const migrations: DatabaseMigration[] = [
{
name: 'init',
up: async (knex) => {
await knex.schema.createTable('files', (table) => {
table.string('id').primary();
table.string('location').notNullable();
table.string('hash').notNullable();
table.dateTime('updatedAt').notNullable();
table.dateTime('syncedAt').nullable();
table.unique('location');
table.index('updatedAt');
table.index('hash');
});
},
down: async (knex) => {
await knex.schema.dropTable('files');
},
},
];
export { migrations };