aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
Commit message (Collapse)AuthorAgeFilesLines
* Use inspect_table inplace of redefining them allJessica Tallon2016-01-181-38/+12
| | | | | | Just like we would have in sqlalchemy-migration inspect_table works and is better than constantly redefining a table in the migration. This switches the migration to use that method.
* Fix #5391 - Alembic migrations would only work for SQLiteJessica Tallon2016-01-181-0/+1
| | | | | | The database connection was being set in a alembic.ini config file, if the user had specified postgres the "sqlite" connection URL in alembic.ini would override that. We probably should look into this more so i've opened #5395.
* Fix #5382 - Add migration and fix so tombstones are removed from collectionsJessica Tallon2016-01-152-0/+110
| | | | | | | | | | | | When an item is deleted it should be removed from all collections, this commit makes that happen. It's got two changes: 1. Adds the code so when an object is soft deleted, it's automatically removed from all collection items 2. Add a migration to fix this issue for those who have tombstones (Graveyard objects) in their collections because of this bug. This commit requires you to run a migration
* Initial alembic migration to base other migrations onBoris Bobrov2016-01-111-0/+22
| | | | Use this migration as a parent for yours.
* Enable alembic as the main tool for migrationsBoris Bobrov2016-01-111-6/+8
| | | | | | Enable alembic for all migrations and limit the max number of sqlalchemy-migration migration. All new migrations must now be in Alembic!
* Fix #5369 - Broken activities cause issues in migrationsJessica Tallon2016-01-062-7/+86
| | | | | | | | | | | This fixes a few bugs in previous migrations and then also introduces a new migration for those who had run the previous migrations without encountering the bugs to ensure that the database is in the same state as those who ran it after the bug fixes introduced in this commit. The commit also ensures that all activities are valid, they should be but they might not be so checks, from now on we should be able to assume that all activities will always be valid.
* Fix a exception db closed exception in migrationsJessica Tallon2015-12-292-6/+27
| | | | | | | Some sqlite migrations were failing due to some problems with sqlite. A work around has been created for these however it does involve loading lots of data into memory. If you have a large database you should consider trying to move to postgres.
* Fix migrations of activity intermediatorsJessica Tallon2015-12-291-11/+11
| | | | | | | There was a problem where it was assuming the tablenames are the same in master as they always were and that isn't the case. This would cause it to raise an exception when trying to look up a table which didn't exist. This fixes that by hardcoding the old tablenames in for this migration.
* Fix #5368 - Improve test efficiancyJessica Tallon2015-12-291-4/+5
| | | | | | | | There were a number of tests where lots of models where being iterated through and then at the end committing them. The problem is all the changes had to be kept in memory or on disk somewhere before they were commit to the database. This fix commits each change as it's being made, allowing resources to be freed and fixing some of the inefficiencies
* Fix #5363 - Collections don't serialize correctlyJessica Tallon2015-11-251-1/+1
|
* Fix #5354 & #5355 - Fix Graveyard.serializeJessica Tallon2015-11-231-7/+14
| | | | | | | | | Graveyard.serialize raised an exception as the deleted datetime objects where not being converted to strings for json encoding. It also didn't deal with the case when there was an actor, it now calls the actor's serialize method as it should. Thanks to Alyeph who provided the patches for both of these.
* Use urljoin to create proper feed media URLsayleph2015-11-191-2/+3
|
* Comment changes for federationJessica Tallon2015-10-204-157/+501
| | | | | | | | | | | | | | This adds a new Comment link table that is used to link between some object and then the comment object, which can be more or less any object in Mediagoblin. The MediaComment has been renamed to TextComment as that more aptly describes what it is. There is migrations for these changes. There is also the conslidation of the Report tables into a single Report table, the same with the Notification objects. This is because both of them split out MediaEntry and Comment versions into their own polymorphic versions from a base, this is no longer a meaningful distinction as comments can be anything.
* Add public_id fixes throughout the codeJessica Tallon2015-10-073-23/+70
| | | | | | | | This adds several things, mainly code which checks for the public id and if it doesn't exist generating it where it can. This is to because we need to keep the public_id to be able to effectively soft delete models. This also adds a public_id field to the Activity along with a migration.
* Add Graveyard modelJessica Tallon2015-10-073-124/+126
| | | | | | | | | | This adds the Graveyard model which is used when a model is deleted, it stores the important "shell" information on the model so it can hard-delete the real object. It also remaps the GenericModelReference references to the new Graveyard model. This also moves the soft deletion setting from __model_args__ to "deletion_mode" on the model.
* Add the __model_args__ deletion codeJessica Tallon2015-10-073-2/+148
| | | | | | | | This adds the "deleted" fields to the models as well as a new __model_args__ section whcih supports the option for changing the deletion type. Deletion is now handled by choosing a deletion method based on the __model_args__["deletion"] setting, for example if it's soft deletion it will call Model.soft_delete()
* Collection changes and migration for federationJessica Tallon2015-10-075-50/+235
| | | | | | | - 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
* Fix some unit tests and bugsJessica Tallon2015-08-243-25/+27
| | | | | | | | | | | | | | | | | | This fixes a lot of the issues with the LocalUser changes that were merged recently. There was a problem where the attributes of LocalUser were not being eagerly loaded and because the Session was detached an exception was being raised when they were accessed. This also fixes some typo's which were introduced. Finally this adds a temporary fix for a potential SQLAlchemy bug, this is a bug where doing: User.query.filter(LocalUser.username == "some_username").first() does NOT yeild a user with the username "some_username" but all users on the site. The temp fix is to just query the LocalUser, this should be resolved when bug is confirmed and fixed upstream.
* Fix #5344 - OAuth NotImplemented exceptionJessica Tallon2015-08-211-0/+59
| | | | | | | | | | | | This introduces a migration which adds a dummy Client, RequestToken and AccessToken. These are used when an invalid request comes in, instead of bailing early, it needs dummy data to prevent timing attacks. This then implements the methods which get the IDs of the dummy objects. If these are changed in the future a migration which checks for the previous dummy object should be created and updates them to reflect the new IDs/tokens.
* Fix serialization after model changesJessica Tallon2015-08-202-10/+11
| | | | | | After the recent model changes there were some bugs which were introduced into the serialization methods of the models. This commit fixes those issues.
* Change structure of MediaEntry and add migrationJessica Tallon2015-08-193-13/+70
| | | | | | This makes the changes needed for federating MediaEntry objects as well as adding the migration and necessary methods to get the public_id just in time (JIT).
* Add the user models to the MODELS listJessica Tallon2015-07-312-16/+37
| | | | | | | | This adds the two new user models (LocalUser and RemoteUser) to the MODELS list that is in models.py. This stops the strange bug that occurs if you migrate a fresh database, the two models don't exist however migrating an existing database would create them as the migrations exist.
* Change codebase to query or create correct User modelJessica Tallon2015-07-311-0/+1
| | | | | | | The code base had many references to User.username and other specific to LocalUser attributes as that was the way it use to exist. This updates those to query on the generic User model but filtering by attributes on the LocalUser.
* Add polymorphic properties to UserJessica Tallon2015-07-312-3/+25
| | | | | | | | | | This adds the ability to search for any user based on the generic User case and be given back the specific LocalUser or RemoteUser. This will require any code using the model to look which attributes they are searching on and specify the specific User model they are on if they're not on the generic User model. This will also require new users to be created with LocalUser.
* Add LocalUser and RemoteUser and migrationJessica Tallon2015-07-312-58/+217
|
* Fix removal of ActivityIntermediatory migrationJessica Tallon2015-06-241-2/+19
| | | | | | | | | | The migration had a problem where other tables still referenced the migration as well as a typo in an earlier migration. They have both been fixed and tested on PostgreSQL and SQLite3. This also fixes a bug where sometimes when creating an activity it'd raise an Exception as the object hadn't got an ID. This has been fixed globally with a fix to the create_activity federation tool.
* Fix some problems with activity mixins and migrationsJessica Tallon2015-05-263-21/+21
|
* Add a more verbose GenericForeignKey implementationJessica Tallon2015-05-262-67/+38
|
* Remove deprecated fields and fix activity creation in toolsJessica Tallon2015-05-261-9/+0
|
* More fixed recommended by ElrondJessica Tallon2015-05-261-11/+8
| | | | | | | This fixes the problem where GenericForeignKey could only be used with models that are in the core of Mediagoblin, it now can be used with any model that SQLAlchemy knows about, including plugins. This also fixes some small bugs caused by incorrect ordering of params into a function.
* Add some fixes Elrond suggested and doc stringsJessica Tallon2015-05-261-14/+41
|
* Add migration to remove ActivityIntermediatorJessica Tallon2015-05-262-59/+12
| | | | | Migration to drop the table and removal of it from the model as it has now been superseeded by the GenericForeignKey field.
* Fix the GenericForeignKey implementationJessica Tallon2015-05-261-22/+36
|
* Migrate Activity to using the new GenericForeignKeyJessica Tallon2015-05-262-47/+166
|
* Add GenericForeignKey field and reference helper modelJessica Tallon2015-05-262-2/+93
|
* Fix the token issues in the migrationChristopher Allan Webber2015-02-171-3/+3
| | | | | | There's no .id on access/request token tables, so fixed to use the .token field. Also switched a reference of client_table -> rt_table
* acess_token->access_tokenChristopher Allan Webber2015-02-171-1/+1
|
* Fixing typo: notifiction->notificationChristopher Allan Webber2015-02-171-1/+1
|
* This one should be dt_to_utc, not db_to_utc, I believeChristopher Allan Webber2015-02-171-1/+1
|
* Fix #1065 - Migrate from native datetimes to UTCJessica Tallon2015-02-152-20/+146
|
* Change 'federation' name to 'api' which is more suitableJessica Tallon2015-02-152-9/+9
|
* Fix #1052 - Make activity cascade delete work when deleting a userJessica Tallon2015-01-271-1/+2
|
* Fix 1e0c938 by allowing target to be translatable in Activity.contentJessica Tallon2014-12-221-9/+17
|
* Allow Activity.content to be fully translatableJessica Tallon2014-12-221-2/+19
|
* Fix #1077 - Fix updating comment via API and add testJessica Tallon2014-12-161-22/+16
|
* Fix #1053 - Add height and width attributes and MetadataProcess taskJessica Tallon2014-12-111-0/+16
| | | | | | | | Added "height" and "width" attributes to "image" and "fullImage" in the API where possible. The height and width of images wasn't being stored anywhere so I've created a task to add or update the metadata on images and also started adding those to new images when they're submitted in the InitialProcessor.
* Fix #1054 - Add missing attributes to Activity.serializeJessica Tallon2014-12-081-0/+5
|
* Fix #1049 - name renamed to displayName for LocationJessica Tallon2014-12-051-3/+3
|
* There's absolutely no reason for a Session().commit object mirrored onto ↵Christopher Allan Webber2014-12-031-4/+0
| | | | | | Session() :) Thanks for catching, Elrond :)
* Make all mixin methods ignore mg_globals and use self._app insteadChristopher Allan Webber2014-12-031-4/+3
| | | | This commit sponsored by Daniel Lang. Thank you!