From 56bfad17e2615d6abfaa91019e169aec9fc77f13 Mon Sep 17 00:00:00 2001 From: Owen Barton Date: Fri, 9 Dec 2022 14:27:56 -0800 Subject: [PATCH] Workaround for schema issue https://github.com/strapi/migration-scripts/issues/19 --- v3-sql-v4-sql/config/database.js | 2 +- v3-sql-v4-sql/reset-schema.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/v3-sql-v4-sql/config/database.js b/v3-sql-v4-sql/config/database.js index 480493d..6c67e0b 100644 --- a/v3-sql-v4-sql/config/database.js +++ b/v3-sql-v4-sql/config/database.js @@ -9,7 +9,7 @@ additionalConfigV3 = { port: 5432, user: 'strapi', password: process.env.DATABASE_PASSWORD, - database: 'strapi', + database: 'strapi3', }, }; diff --git a/v3-sql-v4-sql/reset-schema.sh b/v3-sql-v4-sql/reset-schema.sh index 58376de..5f6d22d 100755 --- a/v3-sql-v4-sql/reset-schema.sh +++ b/v3-sql-v4-sql/reset-schema.sh @@ -2,4 +2,13 @@ export PGPASSWORD="${DATABASE_PASSWORD}" psql -h "${DATABASE_HOST}" -U strapi -d strapi4 -c 'DROP SCHEMA public CASCADE;' -psql -h "${DATABASE_HOST}" -U strapi -d strapi4 -c 'CREATE SCHEMA public;' \ No newline at end of file +psql -h "${DATABASE_HOST}" -U strapi -d strapi4 -c 'CREATE SCHEMA public;' + +# Clone the v3 site to a new database, so we can wrangle some issues. +psql -h "${DATABASE_HOST}" -U strapi -d strapi -c 'DROP DATABASE IF EXISTS strapi3;' +psql -h "${DATABASE_HOST}" -U strapi -d strapi -c 'CREATE DATABASE strapi3 WITH TEMPLATE strapi OWNER strapi;' + +# Wrangle schema issues + +# https://github.com/strapi/migration-scripts/issues/19 +psql -h "${DATABASE_HOST}" -U strapi -d strapi3 -c 'ALTER TABLE strapi_permission DROP COLUMN fields;' \ No newline at end of file