aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
Commit message (Collapse)AuthorAgeFilesLines
* Another db->db.engine because I'm bad at things ;)Christopher Allan Webber2012-01-291-7/+7
| | | | Thanks again Elrond.
* Another MigrationManager fix.Christopher Allan Webber2012-01-291-1/+1
| | | | self.database -> self.database.engine (thanks again Elrond for the catch)
* Make name the primary key in migration recordsChristopher Allan Webber2012-01-291-2/+1
|
* assert was positive when it should be negative, fixedChristopher Allan Webber2012-01-291-1/+1
|
* Use .first() instead of [0]... thanks elrond :)Christopher Allan Webber2012-01-291-5/+2
|
* We should probably add that object to the DB also :PChristopher Allan Webber2012-01-291-1/+2
|
* Commit that new migration record ;)Christopher Allan Webber2012-01-291-0/+1
|
* Add create_new_migration_record method to MigrationManagerChristopher Allan Webber2012-01-291-2/+7
|
* Added init_tables method to MigrationManagerChristopher Allan Webber2012-01-291-2/+12
|
* More work on SQL MigrationManagerChristopher Allan Webber2012-01-291-15/+25
| | | | | | | Added methods: - migration_data - database_current_migration - migrations_to_run
* Removing printer argument now that we use self.printerChristopher Allan Webber2012-01-291-1/+1
|
* Finishing the init_or_migrate functionChristopher Allan Webber2012-01-291-1/+7
|
* More work on migration manager, including adding a dry run functionChristopher Allan Webber2012-01-291-6/+76
|
* Beginnings of the SQL migration managerChristopher Allan Webber2012-01-291-1/+100
|
* Big ol' start of the SQL migrations system.Christopher Allan Webber2012-01-293-0/+97
| | | | Things definitely don't work yet, but should be heading in the right direction.
* Nearly complete support for TagsElrond2012-01-282-4/+52
| | | | | | | | | | | These changes allow all of the rest of the code to use tags in sql as they were used on mongo. It's not efficient at all, as changing tags usually means to remove all old tags and adding all new. The only problem here is: Old slugs for tags are not removed, because they're shared across all MediaTags and dropping orphans is not always easy.
* Add develover sql switchElrond2012-01-282-4/+20
| | | | | | | | | | | | | | | | | 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!
* Let some code support "media without slug"Elrond2012-01-282-13/+10
| | | | | | | | | | | | | | The upcoming SQL database will allow having media without a slug again. This might especially be useful for API support, where the uploaded image (media) does not have *any* information to generate a slug from. This code change mostly allows the sql backend to have no slug in its model and improves some parts to properly handle that. It specifically does not have any web frontend support to edit/create MediaEntries with no slug.
* Move declarative_base Base into base.pyElrond2012-01-262-5/+5
| | | | The base class of all models "Base" should be in base.py.
* Proper url_to_{prev,next} for SQLElrond2012-01-221-0/+21
| | | | Uses complete sqlalchemy syntax now.
* Create a fully functional get_comments for SQLElrond2012-01-221-0/+7
| | | | | Using proper sqlalchemy syntax instead of the emulated mongo one.
* Convert over the license field, too!Christopher Allan Webber2012-01-211-1/+1
|
* License "all rights reserved" default should be None/NULL, not empty stringChristopher Allan Webber2012-01-213-3/+3
|
* Added migration for license field, resolved conflict in db/sql/models.pyAaron Williamson2012-01-197-9/+138
|\
| * Add copyright header and a bit of pep8ificationElrond2012-01-206-11/+113
| | | | | | | | | | | | Nearly all the sql files missed a copyright header. So added it! And while there fixed a few pep8 things.
| * Use custom query classElrond2012-01-201-1/+21
| | | | | | | | | | | | | | | | | | A custom query class allows to add more methods on queries (read: "cursors"). This custom query class especially adds a .sort with a calling convention exactly like the mongo one. Makes a lot of existing code happy!
* | Moved get_license_data to mixin.py, added license to sql media model, added ↵Aaron Williamson2012-01-183-6/+7
| | | | | | | | translation tags to license template.
* | Merge branch 'mediagoblin-upstream' into feature544_basic_license_dataAaron Williamson2012-01-181-0/+28
|\|
| * sql/fake.py: Some fake objects/methods to calm the codeElrond2012-01-181-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | sql/fake.py contains some fake classes and functions to calm the rest of the code base. Or provide super minimal implementations. Currently: - ObjectId "class": It's a function mostly doing int(first_arg) to convert string primary keys into integer primary keys. - InvalidId exception - DESCENING "constant"
* | Fixed a syntax error in edit/views and added back in some missing license ↵Aaron Williamson2012-01-171-1/+8
| | | | | | | | stuff from models
* | Fixed merge with upstreamAaron Williamson2012-01-171-106/+47
| |
* | Merged changes with upstreamAaron Williamson2012-01-1716-318/+902
|\|
| * Add MediaFile table and related infrastructure.Elrond2012-01-113-3/+49
| | | | | | | | | | | | | | | | | | | | | | | | - This adds a new SQL table field type for path tuples. They're stored as '/' separated unicode strings. - Uses it to implement a MediaFile table. - Add relationship and proxy fields on MediaEntry to give a nice media_files "view" there. - Let the converter fill the MediaFile.
| * Fix url_for_self mixupElrond2012-01-112-24/+5
| | | | | | | | | | Move changes from mongo/models:url_for_self back into mixin:url_for_self.
| * Merge branch 'master' of gitorious.org:mediagoblin/mediagoblinChristopher Allan Webber2012-01-103-42/+97
| |\ | | | | | | | | | | | | Conflicts: mediagoblin/db/mongo/models.py
| | * Add DB Mixin classes and use themElrond2012-01-083-61/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bunch of functions on the db objects are really more like "utility functions": They could live outside the classes and be called "by hand" passing the appropiate reference. They usually only use the public API of the object and rarely use database related stuff. Goals: - First, simple: Share the code with the SQL objects, so that the code doesn't need to be duplicated. - Second, it might unclutter the db models and make them more into "model only" stuff. - Doesn't really hurt.
| * | Fixed #724 and added extra infos to the atom feed (author uri and links to ↵Michele Azzolari2012-01-101-3/+5
| |/ | | | | | | the html version of each entry)
| * Import MigrationManager from mongo in mongo backend.Elrond2012-01-042-2/+2
| | | | | | | | | | | | Inside the mongo db backend, use the mongo MigrationManager. This is hopefully the last reference to the generic MigrationManager reference on db.util.
| * sql convert: Use more library functionsElrond2012-01-011-11/+9
| | | | | | | | | | | | | | | | | | | | 1. Use the new setup_connection_and_db_from_config in the sql backend. 2. Use sql and mongo specific functions wherever appropiate instead of the generic "db.X" one. This makes the converter more indepedent of the current backend choice.
| * Factor out check_db_migrations_currentElrond2012-01-013-1/+29
| | | | | | | | | | | | | | | | | | | | When initializing the database connection the current mongo based setup checked for new migrations and warned about them. This was mongo specific so factor'd it out into a more generic check_db_migrations_current function in the mongo backend. Also created a dummy one in the sql backend.
| * Add a .save method on the sql db objectsElrond2011-12-291-1/+9
| | | | | | | | | | | | | | | | This is a shortcut to adding the object to a session (if needed) and giving a commit on the session. In reality, calling code should probably utilize the session on its own and call commit in an appropiate place.
| * Support .get(fieldname) on sql db objectsElrond2011-12-291-0/+3
| | | | | | | | | | | | Some parts of the code like to call .get("somefield") on the db objects. It's easy to support this on sqlalchemy based objects, so lets do it.
| * SQL Model: Add relationship propertiesElrond2011-12-281-0/+5
| | | | | | | | | | | | MediaEntry now has a get_uploader (property) loading the appropiate User object for the MediaEntry (and caches it). MediaComment has the same for author as get_author.
| * SQL Model: Forgot MediaEntry.state fieldElrond2011-12-282-1/+2
| | | | | | | | | | | | | | | | While creating the new SQL model, the "state" field of MediaEntry was left out. Currently using a plain unicode string for it. Maybe should use sqlalchemy.types.Enum?
| * Implement _id proxy on sql objects (on User for now)Elrond2011-12-281-0/+14
| | | | | | | | | | | | | | | | So that the old code can access the primary key still as "._id". Quite simple Python Descriptor thing. Very generic.
| * Turn media.get_uploader into a propertyElrond2011-12-271-1/+2
| | | | | | | | | | | | | | sqlalchemy gives autoloading (hopefully caching) link to other objects as properties. So turn get_uploader on the current mongo based stuff into a property to ease transition.
| * Use media.url_for_self instead of calling urlgen directlyElrond2011-12-271-8/+4
| | | | | | | | | | | | | | | | | | Replace urlgen('ID', user=media.get_uploader().username, media=media.*) by media.url_for_self(urlgen) in a few places. It's just a lot nicer!
| * Move verification key generation to viewElrond2011-12-271-2/+0
| | | | | | | | | | | | | | | | Instead of creating the email verication key on the db model as a default for the field, create it in the registration view. Now all verification key generation is only in auth/views.py!
| * Improve .one() by using sqlalchemy's .one()Elrond2011-12-241-3/+1
| |
| * Add search level one() methodElrond2011-12-241-0/+13
| | | | | | | | And create a _fix_query_dict which converts '_id' to 'id'.