atk4 / schema

Few classes built on top of Agile Data that can take care of your SQL database schema
https://agiletoolkit.org/
MIT License
4 stars 5 forks source link

Add Simulation and/or Manual mode #10

Open FabulousGee opened 5 years ago

FabulousGee commented 5 years ago

I like that add-on quite much but I would really love a simulation mode or a manual mode.

Simulation: I want to add a page "Update DB" which checks all models just like it does now and shows me the differences or migrations to be done. I want to have a look at then and then have another button "Approve" or "Migrate" to start the actual migration to have more control over what is happening. I had the situation yesterday that it deleted a column and I could not even see which one - so whatever was in there is lost now and I don't even know what it was...

Manual mode: A bit like the simulation but even more control. It does the diff and just outputs all "to be done" SQL statements to have the user run them by himself.

I don't really know where to start actually. First thought was to use the Snapshot feature to have it recorded, then do a migration, then roll it back and somehow log the statements in between. But does this make sense or is there an easier way?

abbadon1334 commented 5 years ago

i repop this issue, because with the evolution of schema by @DarkSide666 , probably we can start think about :

(*) only for develop on every run it will check if something is changed and automatically create a version

I think my recent PR #16 can solve the issue about find the correct type of relations.

Because to get the correct type of field type relation we need the related model, to check and migrate correctly all the Model classes of a project i think we must :

What did you think?