From 944c23cd9cb4925277679ca9023f6ada08f19193 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 31 Mar 2021 22:17:48 +0300 Subject: [PATCH] Fix warning when updating to v3.3.1 --- ...derator_role_overrides_thread_id_nullability.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/data/migrations/20210120231512_fix_moderator_role_overrides_thread_id_nullability.js b/src/data/migrations/20210120231512_fix_moderator_role_overrides_thread_id_nullability.js index cbad0ba..6c3b4fe 100644 --- a/src/data/migrations/20210120231512_fix_moderator_role_overrides_thread_id_nullability.js +++ b/src/data/migrations/20210120231512_fix_moderator_role_overrides_thread_id_nullability.js @@ -13,7 +13,9 @@ exports.up = async function(knex) { const rows = await knex.table("old_moderator_role_overrides") .select(); - await knex.table("moderator_role_overrides").insert(rows); + if (rows.length) { + await knex.table("moderator_role_overrides").insert(rows); + } await knex.schema.dropTable("old_moderator_role_overrides"); }; @@ -32,10 +34,12 @@ exports.down = async function(knex) { const rows = await knex.table("new_moderator_role_overrides") .select(); - await knex.table("moderator_role_overrides").insert(rows.map(r => { - delete r.id; - return r; - })); + if (rows.length) { + await knex.table("moderator_role_overrides").insert(rows.map(r => { + delete r.id; + return r; + })); + } await knex.schema.dropTable("new_moderator_role_overrides"); };