mirror of
https://github.com/morten-olsen/plainidx.git
synced 2026-02-08 01:06:24 +01:00
init
This commit is contained in:
24
packages/plaindb/src/documents/migrations/migrations.ts
Normal file
24
packages/plaindb/src/documents/migrations/migrations.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user