aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/dbupdate.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some unused imports and local variables.Ben Sturmfels2021-09-231-2/+2
|
* Apply pyupgrade --py36-plus.Ben Sturmfels2021-09-231-2/+2
| | | | This removes some 'u' prefixes and converts simple format() calls to f-strings.
* Remove remaining imports/calls to six not automatically removed by pyupgrade.Ben Sturmfels2021-03-051-1/+0
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-13/+13
|
* Commit session after alembic updates have finishedBoris Bobrov2017-04-011-2/+4
| | | | | | | | | | After alembic updates we need to add foundations. The tables to add foundations to are created as part of dbupdate process. For some reason Alembic doesn't commit a session in the end. Because the session is not commited, the tables do not really get created. And because of that, foundations fail. The solution is to commit the session after alembic updates.
* dbupdate: Correctly handle plugin foundationsChristopher Allan Webber2016-03-261-1/+1
| | | | | | | * mediagoblin/gmg_commands/dbupdate.py (run_foundations): When adding a plugin's foundations, correctly append both the name and the foundations in a tuple to the list. This prevents errors.
* Only run sqlalchemy-migrate migrations if we have to; separate foundationsChristopher Allan Webber2016-03-261-22/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+12
| | | | | | | | | 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 a TODO to rename run_all_migrations to run_legacy_migrationsChristopher Allan Webber2016-01-111-0/+1
|
* Enable alembic as the main tool for migrationsBoris Bobrov2016-01-111-2/+1
| | | | | | Enable alembic for all migrations and limit the max number of sqlalchemy-migration migration. All new migrations must now be in Alembic!
* Fix various style issuesBoris Bobrov2016-01-111-11/+13
| | | | Sorry, cannot look at them without urge to fix
* Making alembic happen with python 3 only... for now.Christopher Allan Webber2014-09-221-1/+6
| | | | We want to make sure it works nicely first.
* Move the AlembicMigrationManager to top of the module.Berker Peksag2014-08-151-2/+2
| | | | Also, add a simple docstring.
* Add initial Alembic migrations.Berker Peksag2014-08-131-0/+8
|
* Fix dict.keys() in Python 3.Berker Peksag2014-08-131-1/+1
|
* Fix a comment.Berker Peksag2014-08-131-1/+1
|
* Merge remote-tracking branch 'refs/remotes/rodney757/dbupdate'Christopher Allan Webber2014-01-021-0/+1
|\ | | | | | | | | | | Conflicts: mediagoblin/db/util.py mediagoblin/gmg_commands/dbupdate.py
| * don't set logging level to debugRodney Ewing2013-09-021-2/+0
| |
* | Removing the "logging is debug by default in dbupdate"Christopher Allan Webber2013-11-251-1/+2
| | | | | | | | This commit sponsored by David Neudorfer. Thank you!
* | This is a tiny change. I took out the warnings that were displayed when a plugintilly-Q2013-11-211-6/+0
|/ | | | didn't have a FOUNDATIONS dictionary because people found them annoying.
* typo fix in foundations branchRodney Ewing2013-08-021-2/+2
|
* I actually had to do a bit more work than I thought, because I needed to accounttilly-Q2013-07-291-5/+20
| | | | | | 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.
* Merge branch 'rodney757-media_plugins'Christopher Allan Webber2013-07-121-9/+1
|\ | | | | | | | | | | Conflicts: mediagoblin.ini mediagoblin/tests/test_mgoblin_app.ini
| * modified gmg to use plugin media_types and converted image media_type to new ↵Rodney Ewing2013-07-021-9/+1
| | | | | | | | plugin style
* | Updated comments for run_all_migrations and config_spec.ini.Emily O'Leary2013-06-271-2/+6
| |
* | Improved test runtime from 352 seconds to 59 seconds by implementing an ↵Emily O'Leary2013-06-251-3/+11
|/ | | | in-memory sqlite DB and including an option to run migrations on this newly created database by adding a config option called run_migrations to the config_spec and passing it along in app.py to the setup_database function.
* Fixing bug in dbupdate where it would explode on plugin that is missing ↵Christopher Allan Webber2013-05-161-0/+2
| | | | | | | | | | | MODELS or MIGRATIONS The reason it blew up was because in the latter caught exception, it wouldn't set models/migrations to an empty set, so it would actually use the previous run's models/migrations! That's what we get for "leaky" variables on python for loops :) This commit sponsored by Pascal Diogo Antunes. Thank you!
* Switch "sqlite_refcheck" keyword arg to "migrations" which Elrond thinks is ↵Christopher Allan Webber2013-04-261-1/+1
| | | | | | cleaner Also, if migrations is true, *explicitly* say that foreign key checking is off
* Don't turn on sqlite refcheck stuff during migrationsChristopher Allan Webber2013-04-261-1/+1
|
* Move db.sql.migration_tools to db.migration_tools.Elrond2013-01-081-1/+1
| | | | Follow the new trend.
* Move all the migration tools into new migration_tools.pyElrond2013-01-081-1/+1
| | | | | | | | | Factor all the migration related stuff out into a new .db.sql.migration_tools. First we don't have to load this module for our normal server. Second it makes all the import dependencies a little more cleaner.
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-071-1/+1
|
* Move db.sql.util to db.utilSebastian Spaeth2013-01-071-1/+1
| | | | | | | | Now that sqlalchemy is providing the database abstractions, there is no need to hide everything in db.sql. sub-modules. It complicates the code and provides a futher layer of indirection. Move the db.sql.util.py to db.util.py and adapt the importers.
* Move db.sql.migrations to db.migrationsSebastian Spaeth2012-12-251-1/+1
|
* Move db.sql.open to db.openSebastian Spaeth2012-12-251-1/+1
| | | | | | Now that mongo has been ripped out and sqlalchemy is already providing the database abstraction, there is no need to hide everything in the sql module. Transition db.sql.open to db.open and adapt all direct importers.
* RIP out mongoSebastian Spaeth2012-12-251-1/+1
| | | | | | | | | Since sqlalchemy is providing our database abstraction and we have moved away from Mongo as the underlying database, it is now time to simplify things and rip out mongo. This provides the bulk of the changes, and can stand on its own. There are some followup tasks that can be done, such as removing now unneeded abstraction layers, e.g. db.sql.fake.py
* Fixed testsJoar Wandborg2012-09-151-1/+1
| | | | | - Adapt tests to new global_config arg for run_dbupdate - Account for [plugins] not being set in config
* Add OAuth models, plugin DB migrations, api_authJoar Wandborg2012-09-131-4/+42
|
* Make sure MigrationManagers always get Unicode names.Brett Smith2012-07-041-1/+1
| | | | | If we fail to do this, SQLAlchemy complains that we're binding a non-Unicode value to a Unicode column.
* Fix problems from pyflakes outputWill Kahn-Greene2012-06-031-2/+1
|
* SQL based tests and refactored Celery setup stuffChristopher Allan Webber2012-03-261-2/+6
| | | | | | - Changed config files of test configs to use SQL - Updated celery initialization tools, factored them to be able to use the "big instance" application stuff
* Updates so that dbupdate command worksChristopher Allan Webber2012-02-181-6/+11
| | | | | | - Various fixes to dbupdate itself - Switching db/sql/migrations.py to use a dict instead of a list - Registering the function
* No need for self here (thanks again Elrond ;))Christopher Allan Webber2012-01-291-1/+1
|
* Big ol' start of the SQL migrations system.Christopher Allan Webber2012-01-291-0/+84
Things definitely don't work yet, but should be heading in the right direction.