diff --git a/packages/skin-database/.gitignore b/packages/skin-database/.gitignore index 28bdd1b6..c4e59780 100644 --- a/packages/skin-database/.gitignore +++ b/packages/skin-database/.gitignore @@ -5,4 +5,5 @@ uploads/ combined.log hash.txt dist/ -skins.sqlite3 \ No newline at end of file +skins.sqlite3 +skins-dev.sqlite3 \ No newline at end of file diff --git a/packages/skin-database/knexfile.ts b/packages/skin-database/knexfile.ts index 5d8e14ba..960a7212 100644 --- a/packages/skin-database/knexfile.ts +++ b/packages/skin-database/knexfile.ts @@ -24,6 +24,10 @@ const configs = { }, development: { ...production, + connection: { + ...production.connection, + filename: path.join(PROJECT_ROOT, "./skins-dev.sqlite3"), + }, }, production, }; diff --git a/packages/skin-database/migrations/20201119094013_remove_predictions.ts b/packages/skin-database/migrations/20201119094013_remove_predictions.ts new file mode 100644 index 00000000..89b3b409 --- /dev/null +++ b/packages/skin-database/migrations/20201119094013_remove_predictions.ts @@ -0,0 +1,14 @@ +import * as Knex from "knex"; + +export async function up(knex: Knex): Promise { + await knex.schema.dropTable("nsfw_predictions"); +} + +export async function down(knex: Knex): Promise { + await knex.raw( + `CREATE TABLE nsfw_predictions (id INTEGER PRIMARY KEY AUTOINCREMENT, porn REAL, neutral REAL, sexy REAL, hentai REAL, drawing REAL, skin_md5 TEXT NOT NULL);` + ); + await knex.raw( + `CREATE INDEX idx_nsfw_predictions_skin_md5 ON nsfw_predictions(skin_md5);` + ); +} diff --git a/packages/skin-database/migrations/20201119094845_remove_average_color.ts b/packages/skin-database/migrations/20201119094845_remove_average_color.ts new file mode 100644 index 00000000..bee4b695 --- /dev/null +++ b/packages/skin-database/migrations/20201119094845_remove_average_color.ts @@ -0,0 +1,13 @@ +import * as Knex from "knex"; + +export async function up(knex: Knex): Promise { + await knex.schema.table("skins", function (table) { + table.dropColumn("average_color"); + }); +} + +export async function down(knex: Knex): Promise { + await knex.schema.table("skins", function (table) { + table.string("average_color"); + }); +}