| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This removes some 'u' prefixes and converts simple format() calls to f-strings.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Enable alembic for all migrations and limit the max number of
sqlalchemy-migration migration. All new migrations must now be in
Alembic!
|
|
|
|
| |
Sorry, cannot look at them without urge to fix
|
|
|
|
| |
We want to make sure it works nicely first.
|
|
|
|
| |
Also, add a simple docstring.
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| | |
Conflicts:
mediagoblin/db/util.py
mediagoblin/gmg_commands/dbupdate.py
|
| | |
|
| |
| |
| |
| | |
This commit sponsored by David Neudorfer. Thank you!
|
|/
|
|
| |
didn't have a FOUNDATIONS dictionary because people found them annoying.
|
| |
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
mediagoblin.ini
mediagoblin/tests/test_mgoblin_app.ini
|
| |
| |
| |
| | |
plugin style
|
| | |
|
|/
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
| |
cleaner
Also, if migrations is true, *explicitly* say that foreign key checking is off
|
| |
|
|
|
|
| |
Follow the new trend.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
- Adapt tests to new global_config arg for run_dbupdate
- Account for [plugins] not being set in config
|
| |
|
|
|
|
|
| |
If we fail to do this, SQLAlchemy complains that we're binding a
non-Unicode value to a Unicode column.
|
| |
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
- Various fixes to dbupdate itself
- Switching db/sql/migrations.py to use a dict instead of a list
- Registering the function
|
| |
|
|
Things definitely don't work yet, but should be heading in the right direction.
|