Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create base sql file and dump also data? #38

Open
trta911 opened this issue Jul 6, 2021 · 2 comments
Open

create base sql file and dump also data? #38

trta911 opened this issue Jul 6, 2021 · 2 comments

Comments

@trta911
Copy link

trta911 commented Jul 6, 2021

At first, thank you for awesome piece of work! This is exactly I was looking for. Simple, ellegant and powerfull.

So to my problem: I would like to create base.sql with data from my mysql and after inspection of your classess I found nothing like that, only creation of empty base.sql with "-- Put here your base SQL" :-) Is there some function? Something like "createBaseSqlSnapshot" -> function that dump structure as "initial" version.

If there is no such mechanism to make snapshot of your current database and save it to "base.sql" maybe there is option to add that function.

And second question, If I have some codebooks and I would like the data also make versioned is this possible? Like some configuration function that tells what table(s) be dumped with data and make "truncate codebook" command + "insert into codebook"

Thank you

@byjg
Copy link
Owner

byjg commented Jul 7, 2021

Hello!!

Thank you so much! That makes me feel happy to contribute to open source.

We don't create the base.sql because each user has your own way to create/populate this file. Right now what we have is the Migrate CLI to create only the directory structure with dummy files:

migrate create --path /path/to/sql 

It is a great feature to create from a dump directly from the database tough.

Regarding the second question if the codebook is stored in a database table, yes, it is possible. You just need to create the up and down SQL files and the migration component will do the rest for you.

It is important to note migration scripts with DML (insert, delete, update, truncate) often can cause trouble. To avoid this, It is desirable that all data change be done by the migration and not outside. Otherwise, you'll can face failure in the migration.

@byjg
Copy link
Owner

byjg commented Jul 19, 2021

Just to know if this answer you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants