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

Refresh the database view after migration #24

Open
multiwebinc opened this issue Feb 16, 2022 · 6 comments
Open

Refresh the database view after migration #24

multiwebinc opened this issue Feb 16, 2022 · 6 comments

Comments

@multiwebinc
Copy link

When a migration is applied or rolled back in the backend, the list of tables in the Database tab is not updated in real time. A manual refresh needs to be performed to view any changes. I suggest automatically refreshing the view any time a migration is applied or rolled back.

@bennothommo
Copy link
Member

@multiwebinc I've taken a look at this, and I think this has highlighted a workflow flaw with the Builder plugin more than anything.

If you rollback a migration, the database is automatically updated based on the migrations and reflects the state of the database at that version. However, the database editor - when saving changes - is set to create a new version at the end of the upgrade path. For example, if I have a plugin at 1.0.5, and roll it back to 1.0.4 and then make an edit to the database tables, it will create a migration to run at 1.0.6 (ie. after the latest version), which may result in issues if were to make an edit to a table that is dropped in 1.0.5.

The main issue is that the database table list reads the database tables direct from the database, so it doesn't consider that there may be some migrations that are not yet applied.

The way I see it, we have two options - we either update the database editor to always reflect the latest version, which may mean parsing through the migrations and generating the list from that data, or alternatively, we change the database editor so that if you rollback to a previous version and make edits, it creates a new version history from that point and deletes any future migrations.

@bennothommo
Copy link
Member

@LukeTowers any thoughts on the above comment?

@LukeTowers
Copy link
Member

I don't think this plugin should be actively deleting any files or code if it can help it.

@bennothommo
Copy link
Member

Well that's gonna make my latest branch stick out like a sore thumb... 😅

@LukeTowers
Copy link
Member

@bennothommo 😂 I meant moreso that we shouldn't be deleting files automatically without even allowing the user to make the decision. Explicitly triggered deletion is fine.

@multiwebinc
Copy link
Author

What about disabling the database tab if there are pending migrations?

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

No branches or pull requests

3 participants