-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feat: Ignore source tables missing in target model #44
Comments
Is there a way to create them and not drop these tables? |
Sure, if you know the schema of the no longer used tables. I took a quick look, but didn't find a description to quickly re-create the tables in the target model, so it was much quicker to drop them in the source model. I saw no point in keeping this data around anyway, as it is clearly no longer used. |
@Straightpool In my use case I don't want to lose these stats after migration, so I will try to work around it. |
@Straightpool The way to avoide this to happen and have these tables created is to use |
Thanks a lot for this very helpful script! The following is a feature request to make this even easier to new users.
Issue
When running the migration script with extra tables in the source which are not in the target model the migration script will exit with a fatal error
Expected behavior
The migration script should ignore tables in the source model not needed in the target model
Steps to reproduce
Sample Error:
FATAL[2023-02-06T10:31:14Z] ❌ pq: relation "dashboard_usage_sums" does not exist INSERT INTO "dashboard_usage_sums" VALUES(0,'2022-01-20 03:56:51',0,0,0,0,0,0,0,0,0,0,0,0) - failed to import dump file to Postgres.
Cause
Apparently, Grafana does not create all tables on the first run but some non critical ones at a later time and/or does not clean up obsolete tables when migrating between different Grafana DB versions.
Version info
Grafana v9.3.6 sqlite3 DB migrated over multiple versions of Grafana from version 7.x to 9.3.6
In my sample case to be dropped tables
After dropping above tables in my own sqlite3 data file the migration completed without error and everything still work fine as expected, so nothing of value was lost in migration, as expected.
The text was updated successfully, but these errors were encountered: