aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
Commit message (Collapse)AuthorAgeFilesLines
* Convert (gps) image media_data.Elrond2012-03-141-0/+23
| | | | | | Add mongo_to_sql convert part for converting the media_data for images. This currently drops the exif data and thus only converts gps data.
* Migration to move gps data aroundElrond2012-03-141-0/+18
| | | | | Move media_data["gps"]["*"] to media_data["gps_*"]. In preparation for media_data.gps_*
* Fix VideoData insertionChristopher Allan Webber2012-03-141-1/+1
|
* Convert media_data for videoElrond2012-03-131-0/+15
| | | | | This creates fresh VideoData rows for all the videos in the mongodb.
* Improve logging of sql queries a bit.Elrond2012-03-101-1/+3
| | | | | | | | | | | | | | | | Docs: http://docs.sqlalchemy.org/en/latest/core/engines.html#configuring-logging So for an application utilizing python logging for real (and MediaGoblin should) the rule is: - Don't use echo=True, - but reconfigure the appropiate loggers' level. So replaced the echo=True by a line to reconfigure the appropiate logger to achieve the same effect. This still dumps whole bloats of SQL queries into the main log, but at least they're not duped any more.
* Forgot to add FileKeynames to MODELSElrond2012-03-081-1/+1
|
* Normalize MediaFile.name (make it a foreignkey)Elrond2012-03-081-3/+32
| | | | | | | | | | The name part of a MediaFile is only using a very limited number of items. Currently things like "original" or "thumb". So instead of storing the string on each entry, just store a short integer referencing the FileKeynames table and have the appropiate string there.
* SQL: Added MediaFile and MediaAttachmentFile to MODELSJoar Wandborg2012-03-081-1/+2
|
* Generic generate_slug for mongo and sql.Elrond2012-03-072-11/+18
| | | | | | | | | | Using the new check_media_slug_used it is possible to have one generic generate_slug in the mixin class instead of in each db class. In the sql variant self.id is not always set: If the slug alone would create a dupe the current code decides for "no slug at all".
* Generic check_media_slug_used db utility.Elrond2012-03-053-3/+21
| | | | | | | | 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()
* SQL: Tool to cleanup unused tag slugs.Elrond2012-03-051-0/+22
| | | | | | | | The current SQL layout/sqlalchemy strucuture can't detect whether a slug isn't needed any more and delete it. So provide a tool function to cleanup unused slugs. It's currently not hooked to any gmg function!
* Implement atomic_update for SQL.Elrond2012-03-042-1/+15
| | | | | | 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-042-1/+13
| | | | | | | | | 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.
* And media_data_init() for sql as a dummyElrond2012-03-031-0/+4
| | | | Needs to be implemented.
* Create a fake MediaEntry.media_data for sqlElrond2012-03-031-0/+5
| | | | | | | So that the SQL backend is more useable, let the MediaEntry have a faked media_data. It's extremely fake: The returned dict is always a new one. So any stored info is even lost!
* Video media_data: Change layout in the mongo worldElrond2012-03-012-0/+17
| | | | | | | | | Change the media_data for video from entry.media_data["video"] to use entry.media_data directly. Also start a bare MediaEntry.media_data_init(**kwargs) method for setting up the media_data and possibly initialising it with kwargs.
* SQL: Improve video media_data tableElrond2012-03-011-0/+1
| | | | | | 1. Make the foreignkey the primary_key. 2. Add width/height, as those are currently in use for the media_data
* Cleanup Session after each request.Elrond2012-02-281-0/+1
| | | | | | | | | | | It's good practice to cleanup the SQL session after each request so that the next request gets a fresh one. It's an application decision whether one wants a just-in-case ROLLBACK or COMMIT. There are two ideas behind it, really. I have decided for ROLLBACK. The idea is "if you forget to commit your changes yourself, there's something broken. Maybe you got an exception?".
* Attachment support in the SQL backendElrond2012-02-282-2/+36
| | | | | | | | | attachments working with the sql backend. - SQL Schema for attachment files, ordering attachments by their name, not by the submission order (as earlier). - Dot-Notation for attachments, where missing. - convert existing attachments over from mongo -> sql
* Let SQL objects support .setdefault() and .delete()Elrond2012-02-261-0/+10
| | | | | | | | | | Some parts in the code like to use .setdefault(). So make them happy and provide a minimal version. It ignores the given default and expects the attribute to already exist. Other parts use .delete() to delete a complete object. This version expects the object to live in a session and also does the final commit.
* Allow .id instead of ._id for the Mongo backendElrond2012-02-251-0/+15
| | | | | | | | | | To allow easier migration to the SQLAlchemy style .id give the User and MediaEntry mongo classes an alias attribute of .id that maps to ['_id']. Use it in the upload process, because this was one of the last positions with a ['_id'] instead of ._id (due to a bug in mongokit).
* Create "gmg convert_mongo_to_sql" commandElrond2012-02-231-3/+3
| | | | | | | | | Finally, to make testing of sql a bit easier, create a bin/gmg command to do the conversion from mongo to sql. It's currently named "convert_mongo_to_sql". The most important option is the gmg -cf option to give a configfile with the appropiate sql_engine definition.
* mongo to sql convert: Better OrderingElrond2012-02-231-4/+4
| | | | | | | | Order the conversion by the "created" attribute. That way the sql ids are mostly in the order they would have been, if sql was used earlier. Makes things nicer to look at in a db dump.
* Updates so that dbupdate command worksChristopher Allan Webber2012-02-181-1/+1
| | | | | | - Various fixes to dbupdate itself - Switching db/sql/migrations.py to use a dict instead of a list - Registering the function
* Merge branch 'master' into sqlmigrateChristopher Allan Webber2012-02-183-9/+36
|\
| * Start having useful defaults for SQLElrond2012-02-181-2/+1
| | | | | | | | | | | | | | | | | | | | Mostly this means: Havintg a config_spec.ini that has a local (relative to mediagoblin.ini) sqlite db with the name "mediagoblin.db". Also: - Add to .gitignore - Add a notice to mediagoblin.ini about the db
| * Fix MediaTag __init__ to handle no argsElrond2012-02-181-3/+5
| | | | | | | | | | Let the init code also handle createing a fresh clean instance without any attrs set.
| * SQL: fail_metadata as JSON encoded fieldElrond2012-02-183-4/+30
| | | | | | | | | | | | | | | | fail_metadata used to be a dict in mongo. So a json encoded field should be okay too. We could use a pickled field instead, which would be more flexible.
* | Merge branch 'master' into sqlmigrateChristopher Allan Webber2012-02-1817-43/+109
|\| | | | | | | | | Conflicts: mediagoblin/db/sql/models.py
| * Drop pre-rendered html: MediaComment.content_htmlElrond2012-02-185-10/+22
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the MediaComment.content_html part.
| * Drop pre-rendered html: MediaEntry.description_htmlElrond2012-02-185-12/+23
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the MediaEntry.description_html part.
| * Drop pre-rendered html: User.bio_htmlElrond2012-02-185-4/+17
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the User.bio_html part.
| * sql db design suggestions by Svavar KjarrvalElrond2012-02-111-3/+26
| | | | | | | | | | | | | | | | Many thanks go to Svavar Kjarrval who has taken a deeper look at our current sql db design and made a bunch of suggestions. The suggestions are currently put as TODO items in the docstrings. This way we can keep track of them directly where we need it.
| * Fix copyright statements; add LICENSE for EXIF.pyWill Kahn-Greene2012-02-087-7/+7
| |
| * It's 2012 all up in hereChristopher Allan Webber2012-02-0210-10/+10
| |
| * Some small SQL model improvementsElrond2012-01-292-4/+11
| | | | | | | | | | | | | | | | - Add default for User.email_verified - Add default for MediaEntry.state - Let PathTupleWithSlashes store [] as "NULL", but not handling the reverse properly yet! - Add _id alias field to MediaEntry and MediaComment
* | Excepting that migration 1 doesn't work(!), sqlalchemy migration branch workingChristopher Allan Webber2012-01-291-2/+5
| | | | | | | | | | | | | | The reason migration 1 doesn't work, and is commented out, is because of sqlalchemy-migrate not handling certain constraints while dropping binary sqlite columns right. See also: http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=143&thanks=143&ts=1327882242
* | Update the string outputs to match our tests: newlines, ...->:, etc.Christopher Allan Webber2012-01-291-2/+2
| |
* | migrations_to_run here a list, so no reason to call itChristopher Allan Webber2012-01-291-1/+1
| |
* | self.latest_migration now a property, so we shouldn't __call__ it!Christopher Allan Webber2012-01-291-1/+1
| |
* | For clarity, self.database -> self.session.Christopher Allan Webber2012-01-291-12/+12
| | | | | | | | | | Actually, I'm not even sure *that* is ideal! But better than what we had...
* | Yet *another* self.database -> self.database.bind fix!Christopher Allan Webber2012-01-291-1/+1
| |
* | Fix database_current_version for when self.migration_data is None.Christopher Allan Webber2012-01-291-0/+4
| |
* | another db -> db.bind fix.Christopher Allan Webber2012-01-291-1/+1
| |
* | A few basic fixes to sql/util.pyChristopher Allan Webber2012-01-291-5/+9
| | | | | | | | | | | | - MigrationRecord to MigrationData, again - If the table doesn't exist, return None for database_current_migration - database.engine -> database.bind
* | Also switch database_current_migration to a propertyChristopher Allan Webber2012-01-291-3/+4
| |
* | Make latest_migration a propertyChristopher Allan Webber2012-01-291-0/+1
| |
* | Import MigrationData, not MigrationRecordChristopher Allan Webber2012-01-291-3/+3
| |
* | import changeset into sql modelsChristopher Allan Webber2012-01-291-0/+7
| |
* | Another db->db.engine because I'm bad at things ;)Christopher Allan Webber2012-01-291-7/+7
| | | | | | | | Thanks again Elrond.