strapi / migration-scripts

Collection of Strapi Migration scripts
58 stars 58 forks source link

sql migration: fixed table names, better sql and singular api names. #48

Closed vitormanfredini closed 2 years ago

vitormanfredini commented 2 years ago

Hi, I'm working on migrating a strapi project (on postgres) from v3 to v4. After using codemods succesfully to migrate the code, I had to change some things in the migration scripts: 1- User tables had different names (I couldn't find any references to the current names. maybe in earlier versions?) 2- In a SQL query, I added double quotes around the table name so it supports names with -. 3- I applied pluralize.singular for uids like api::pluralname.pluralname in the same way codemods does. Now the field related_type on table files_related_morphs gets migrated correctly and I don't lose the relation to media uploads.

Number 3 is probably necessary only if the code was migrated using codemods, so maybe the script needs to check that somehow. Let me know if you need any extra info.

derrickmehaffy commented 2 years ago

closing in favor of #56 thank you @vitormanfredini !