aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/migration_tools.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some unused imports and local variables.Ben Sturmfels2021-09-231-3/+0
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-20/+19
|
* move alembic.ini to python app dirBoris Bobrov2017-11-141-3/+2
|
* Only run sqlalchemy-migrate migrations if we have to; separate foundationsChristopher Allan Webber2016-03-261-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to get things to the point where Alembic can run on its own for new databases and initialize the whole database on its own. There are risks to not doing so, see #5413 for details. There's a lot more here that could removed or cleaned up once sqlalchemy-migrate is *completely* removed in the future. * mediagoblin/db/migration_tools.py (MigrationManager.foundations): Removed attribute. (MigrationManager.populate_table_foundations): Removed method. (MigrationManager.init_or_migrate): Removed call to deprecated method. (populate_table_foundations): New function, refactored from former MigrationManager method of same name. * mediagoblin/gmg_commands/dbupdate.py: Import populate_table_foundations. (DatabaseData.foundations): Remove attribute. (DatabaseData.make_migration_manager): Adjust instantiation of MigrationManager. (gather_database_data): Move out the work of building up foundations data. (run_foundations): New method, incorporating logic for gathering and running foundations which was previously spread across other functions and methods. (run_alembic_migrations): Remove deprecated comment. (run_dbupdate): Only run sqlalchemy migrations if we have to. Also run run_foundations if we are setting up this database for the first time. (sqam_migrations_to_run): New method.
* dbupdate updates to use plugin migrations if availableChristopher Allan Webber2016-03-261-46/+0
| | | | | | | | | This makes use of the recently added "build_alembic_config" tool and removes AlembicMigrationManager. * mediagoblin/db/migration_tools.py (AlembicMigrationManager): Removed. * mediagoblin/gmg_commands/dbupdate.py (run_alembic_migrations): Adjusted to use recently added build_alembic_config tool.
* Add build_alembic_config, use it to add plugin migrations to alembic configChristopher Allan Webber2016-03-261-0/+34
|
* typo fix: Set sqlalchemy.url, not qlalchemy.urlChristopher Allan Webber2016-03-021-1/+1
|
* Remove old hack to support pre-0.7.5 Alembic versionsChristopher Allan Webber2016-03-021-3/+0
| | | | | Thanks to Jessica Tallon for pointing out this TODO and its associated hack could be removed.
* Fix #5398 and #5395 - Fix tests failing due to problem creating connection ↵Jessica Tallon2016-01-201-2/+9
| | | | | | | | | | | | | | | for alembic For some reason the alembic connection wasn't seeing any tables that existed however the existing connection works well and we shouldn't be creating a brand new one when we have one ready to use. I've used a little bit of a hack due to our old version of alembic. After 0.7.5 of alembic it offers a `Config.attributes` dictionary which is designed to allow you to pass your connection/engine/whatever to the env.py config script so you're not required to create new ones. As we're on an older version I just create a dictionary with the same name and use it as otherwise documented. It seems this is the suggested fix for #5395 and it fixes #5398 too.
* Fix #5391 - Alembic migrations would only work for SQLiteJessica Tallon2016-01-181-0/+1
| | | | | | The database connection was being set in a alembic.ini config file, if the user had specified postgres the "sqlite" connection URL in alembic.ini would override that. We probably should look into this more so i've opened #5395.
* Enable alembic as the main tool for migrationsBoris Bobrov2016-01-111-6/+8
| | | | | | Enable alembic for all migrations and limit the max number of sqlalchemy-migration migration. All new migrations must now be in Alembic!
* Fix a exception db closed exception in migrationsJessica Tallon2015-12-291-0/+21
| | | | | | | Some sqlite migrations were failing due to some problems with sqlite. A work around has been created for these however it does involve loading lots of data into memory. If you have a large database you should consider trying to move to postgres.
* Do not call AlembicMigrationManager.init_tables() for now.Berker Peksag2014-10-021-6/+8
| | | | sqlalchemy-migrate will do this for us.
* Provide a better manager API for Alembic.Berker Peksag2014-08-151-6/+27
|
* Add initial Alembic migrations.Berker Peksag2014-08-131-0/+29
|
* func_name removed in Python 3.Berker Peksag2014-07-281-1/+1
|
* Continue to port GMG codebase.Berker Peksag2014-05-081-1/+3
|
* Renaming replace_table to replace_table_hack and documenting why it's a hackChristopher Allan Webber2013-10-101-3/+9
| | | | | | We'd still prefer people use other solutions when possible! This commit sponsored by Michał Masłowski. Thank you!
* Actually rename the table back, or else we just lose the old table! ;)Christopher Allan Webber2013-10-101-1/+1
|
* I made some changes in this commit to help out with other people trying to worktilly-Q2013-10-091-0/+27
| | | | | | around the SQLite problems with Alter table. I added a new function to migration_tools (replace_table) which does all the work I did in my migration of core__users, but is now usable for other migrations.
* Starting to write unit tests...tilly-Q2013-07-301-4/+4
|
* I actually had to do a bit more work than I thought, because I needed to accounttilly-Q2013-07-291-8/+7
| | | | | | for plugins. In this commit I changed the MigrationManager and DatabaseData ob- jects to account for FOUNDATIONS in any plugin's (or main program's) models.py file.
* This was a very simple ticket actually. I created a list called FOUNDATIONS intilly-Q2013-07-291-1/+15
| | | | | | | | | | | | | mediagoblin/db/models.py. This list holds all of the information about rows that should be created at database initialization. Read the documentation near the FOUNDATIONS list to understand the proper format for this list. All of the work is done through a new method on MigrationManager in mediagoblin/db/migrations_tools.py. This method, `populate_table_foundations` parses the FOUNDATIONS list and creates the foundations based on the data incl- uded. This only ever happens when the database is initialized. Migrations to releases with new Foundations should be very easy just using the basic database functionality.
* Changing the information spat out while printing from media types->pluginsChristopher Allan Webber2013-07-121-2/+1
| | | | | | Previously it called even plugins media types. Ha! This commit sponsored by Jon Merkley. Thank you!
* Give a more useful error if a table already exists and so we can't create it ↵Christopher Allan Webber2013-03-041-1/+7
| | | | | | during migrations This commit sponsored by Andrzej Prochyra. Thanks!
* Move db.sql.migration_tools to db.migration_tools.Elrond2013-01-081-0/+270
Follow the new trend.