1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

Server: Fix migrations

This commit is contained in:
Laurent Cozic 2021-08-13 21:58:39 +01:00
parent 32c8cc9030
commit f518549cfe
2 changed files with 10 additions and 6 deletions

View File

@ -6,9 +6,9 @@ export async function up(db: DbConnection): Promise<any> {
table.text('key', 'mediumtext').defaultTo('').notNullable();
});
await db.schema.alterTable('emails', function(table: Knex.CreateTableBuilder) {
table.unique(['recipient_email', 'key']);
});
// await db.schema.alterTable('emails', function(table: Knex.CreateTableBuilder) {
// table.unique(['recipient_email', 'key']);
// });
}
export async function down(_db: DbConnection): Promise<any> {

View File

@ -2,9 +2,13 @@ import { Knex } from 'knex';
import { DbConnection } from '../db';
export async function up(db: DbConnection): Promise<any> {
try {
await db.schema.alterTable('emails', function(table: Knex.CreateTableBuilder) {
table.dropUnique(['recipient_email', 'key']);
});
} catch (error) {
console.warn('Could not drop unique constraint - this is not an error.', error);
}
}
export async function down(_db: DbConnection): Promise<any> {