aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-1/+1
|
* Collection changes and migration for federationJessica Tallon2015-10-071-2/+2
| | | | | | | - Adds a "type" column to the Collection object and allows the CollectionItem model to contain any object. - Changes "items" to "num_items" as per TODO - Renames "uploader", "creator" and "user" to a common "actor" in most places
* Only conditionally import Session in db/util.pyChristopher Allan Webber2014-12-031-1/+5
|
* Always remove the session when running check_db_up_to_date()Christopher Allan Webber2014-08-151-5/+10
| | | | This commit sponsored by Francois Marier. Thank you!
* Not only the web server starts MediaGoblin app! Better phrasing.Christopher Allan Webber2014-01-021-1/+1
|
* check if db is up to dateRodney Ewing2013-09-021-1/+16
|
* Patch by Strum. Ticket #451 - Convert all mongokit style .find, .find_one, ↵Rodney Ewing2013-07-111-1/+1
| | | | .one calls over to SQLAlchemy queries
* Use GenerateSlugMixin for collections.Elrond2013-04-061-1/+1
| | | | | Use the new way of generating slugs also for collections. Also drop the dummy_db arg to check_collection_slug_used.
* Simplify check_media_slug_usedSebastian Spaeth2013-01-151-5/+4
| | | | | | | Remove the unused dummy_db argument and generally make the function readable. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move all the migration tools into new migration_tools.pyElrond2013-01-081-249/+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.
* Mv db.sql.base to db.baseSebastian Spaeth2013-01-071-1/+1
| | | | | | | | This concludes the db.sql.* -> db.* move. Our db abstraction layer is sqlalchemy, so there is no need to a separate db.sql.* hierarchy. All tests have been run for each of the commit series to make sure everything works at every step.
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-071-3/+3
|
* Move db.sql.util to db.utilSebastian Spaeth2013-01-071-3/+309
| | | | | | | | 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.
* Remove mediagoblin.db.sql.fake.DESCENDINGSebastian Spaeth2013-01-071-1/+0
| | | | | | | | This is the last remnant that requires us to keep db.sql.fake.py. Use ModelName.desc() or sqlalchemy.sql.expression.desc(column) to achieve descending sorts. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Remove ObjectId from the treeSebastian Spaeth2012-12-251-1/+1
| | | | | | | This was one of the last remaining Mongo holdouts and has been removed from the tree herewith. Good bye, ObjectId. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Remove InvalidIdSebastian Spaeth2012-12-251-1/+1
| | | | | | It was a NoOp in our Non-mongo world. So it is safe to remove. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* RIP out mongoSebastian Spaeth2012-12-251-13/+4
| | | | | | | | | 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
* Added basic collection functionalityAaron Williamson2012-09-181-1/+1
|
* Create function to search media by slug.Elrond2012-03-161-2/+4
| | | | | | | | | Searching media by slug is easy on mongo. But doing the joins in sqlalchemy is not as nice. So created a function for doing it. Well, and create the same function for mongo, so that it also works.
* Generic check_media_slug_used db utility.Elrond2012-03-051-2/+2
| | | | | | | | In two cases (generating a new slug and editing the slug) it is nice to know in advance (before the db gets angry) that the slug is used/free. So created a db utility function to check for this on mongo and sql: check_media_slug_used()
* Implement atomic_update for SQL.Elrond2012-03-041-0/+1
| | | | | | On sqlalchemy most updates are atomic enough for most use cases. Anyway, here is an atomic_update that is compatible to the mongo version.
* Create atomic_update db utility functionElrond2012-03-041-1/+2
| | | | | | | | | In some cases (notably the mark_entry_failed function) it is useful to have atomic update functionality on the db. On mongo this requires special syntax. So created an atomic_update function for mongo and started to use it in mark_entry_failed.
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* Add develover sql switchElrond2012-01-281-2/+9
| | | | | | | | | | | | | | | | | If you want to play with the current state of sql, you need a switch to turn it on. So here is the super secret developer switch. So you want to know where it is? Here it is: Create a file mediagoblin/db/sql_switch.py and put one line in it: "use_sql = True" (or False to disable again). Right, that's it. If you want to delete it, remember to delete the *.pyc too. Be careful not to "git add" it by accident!
* Import MigrationManager from mongo in mongo backend.Elrond2012-01-041-1/+1
| | | | | | Inside the mongo db backend, use the mongo MigrationManager. This is hopefully the last reference to the generic MigrationManager reference on db.util.
* Move db/util.py -> db/mongo/util.pyElrond2011-12-201-276/+2
| | | | | - Change some reference - Provide a wrapper db/util.py
* Move db/indexes.py to db/mongo/indexes.pyElrond2011-12-201-1/+1
| | | | And change references (one!).
* has_key is deprecated, converting uses to use "in" operator.Nathan Yergler2011-10-011-1/+1
|
* Whitespace and formatting cleanup.Nathan Yergler2011-10-011-2/+3
| | | | | | | * Removed trailing whitespace * Line length < 80 where possible * Honor conventions on number of blank lines * Honor conventions about spaces around :, =
* 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|
* Merge branch 'master' into f411_new_migrationsChristopher Allan Webber2011-07-131-3/+10
|\ | | | | | | | | Conflicts: mediagoblin/db/open.py
| * Changing things back so that we keep information about deprecatedChristopher Allan Webber2011-07-091-3/+10
| | | | | | | | indexes around.
* | Duplicate migration numbers not allowed, broChristopher Allan Webber2011-07-131-0/+2
| |
* | We should *raise* MissingCurrentMigration :)Christopher Allan Webber2011-07-131-1/+1
| | | | | | | | Thanks for the catch, Elrond.
* | Made it so that it's migrate_new() which installs the migrationChristopher Allan Webber2011-07-101-3/+18
| | | | | | | | version if missing, migrations_to_run just throws an error if not set
* | No reason to have migration_number optional or default to NoneChristopher Allan Webber2011-07-101-1/+1
| |
* | Move the call to install_migration_version_if_missing() to migrations_to_run()Christopher Allan Webber2011-07-101-5/+7
| | | | | | | | | | This means there's a serious side effect of calling this, but there's no way to get useful data here unless if that's set anyway.
* | install_migration_version_if_missing() now a separate functionChristopher Allan Webber2011-07-101-7/+19
| | | | | | | | | | Also added it to MigrationManager.migrate_new(), because we'll always need a migration number when migrating.
* | Make sure all these strings in db/util.py are unicodeChristopher Allan Webber2011-07-101-6/+6
| |
* | Simpler run_migrations method.Christopher Allan Webber2011-07-101-16/+13
| | | | | | | | | | | | | | | | Allows for calbacks, should be useful for printing output and catching things in tests. Gets rid of the generator stuff which now that I think of it is a messy idea.
* | Making sure migration_number > 0 :)Christopher Allan Webber2011-07-091-1/+3
| |
* | run_new_migrations() makes more senseChristopher Allan Webber2011-07-091-1/+1
| |
* | Some instructions in the RegisterMigration docstring on how to use.Christopher Allan Webber2011-07-091-0/+13
| |
* | latest_migration now returns migration numbers only, and 0 if no migrations.Christopher Allan Webber2011-07-091-6/+10
| |
* | Migrating quietly, not iteratively, that comment should say!Christopher Allan Webber2011-07-091-1/+1
| |
* | New migration utility code.... I haven't tested this! ;)Christopher Allan Webber2011-07-091-0/+136
|/ | | | | | | | I think it's looking right though. - Provides MigrationManager which should have plenty of utilities for doing migrations hopefully correctly :) - Provides RegisterMigration which should be able to decorate migrations and register them in doing so
* adds previous and next links in the sidebarCaleb Forbes Davis V2011-07-021-1/+1
| | | | | | | | Feature #401 - previous/next navigation on media pages * media.html includes a new prev_next.html template containing the links * prev_next.html calls functions added to the media model to retrieve the appropriate objects from the database, formatted with urlgen * a small change to util.py brings ASCENDING into the mix
* Documenging index utils and adjusting how remove_deprecated_indexes gets ↵Christopher Allan Webber2011-06-271-2/+17
| | | | | | | | | | arguments More specifically, we now just take a dictionary of lists, like: {'collection': ['index_identifier1', 'index_identifier2']} Previously we took something with more info like in add_new_indexes, but that extra info isn't really necessary.
* Tools to add / remove indexes from collectionsChristopher Allan Webber2011-06-271-0/+65
|
* Move InvalidId to db.utilElrond2011-06-201-0/+1
| | | | | | Instead of import InvalidId from the low level bson module, first import it in our db.util wrapper and second import it from pymongo.errors.