kawadhiya21 / mysql-migrations

A tool to use with mysql package to maintain migrations
MIT License
31 stars 25 forks source link

schema.sql missing events and seed data #30

Open lewismoten opened 2 months ago

lewismoten commented 2 months ago

From what I understand, schema.sql helps bypass all the migration scripts and sets up a new database in the current state for new developers. Upon further investigation, there appears to be many problems that prevents this from happening.

I can run load-from-schema to populate the mysql_migrations_347ertt3e table, but seed data, functions, procedures, and events are still missing. I've already suggested a fix for the missing functions and procedures in issue #29. Events could also be exported in the same way by including the flag --events when dumping the database.

The remaining issue is that seed data for lookup tables is not exported - and this seems intentional as the mysqldump command is explicitly flagged not to include any data.

mysqldump --no-data

https://github.com/kawadhiya21/mysql-migrations/blob/65c52086c766d5c91508ba66c3b811682484c4b2/core_functions.js#L121

I would like an option to dump the data as well. Naming the commands as update-data and load-from-data would seem appropriate. You could include the flag --no-create-info so that none of the schema data is added to create tables.