aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
Commit message (Collapse)AuthorAgeFilesLines
* Remove old hack to support pre-0.7.5 Alembic versionsChristopher Allan Webber2016-03-021-3/+0
| | | | | Thanks to Jessica Tallon for pointing out this TODO and its associated hack could be removed.
* Fix #5376 - Ensure links have correct IDJessica Tallon2016-03-012-14/+9
| | | | | | | This ensures that links to comments have the correct ID (the ID of the Comment object) as well as fixing deletion on reports and fixing a few other little things. I hope this fixes the #5376 issue, though cannot reproduce so unable to confirm.
* Fix #5431 - Typo in modelsAndrew Browning2016-03-011-1/+1
| | | | Fix a typo in models.py.
* Fixes #5421 - Ensures Report.object_id is nullableJessica Tallon2016-02-291-0/+33
| | | | | | | It seems there was a commit for a while where the migration was making Report.object_id NOT NULL and this caused an errror when a report deleted the associated object (media). This migrtion checks it's nullable and if not, alters it so it is.
* Migration for #5415 - I forgot it, Doh!Jessica Tallon2016-02-291-0/+44
|
* Fix a typo in consolidate_reports migrationJessica Tallon2016-02-291-1/+1
|
* Fix #5415 - Deleted comments get removed properly when tombstonesJessica Tallon2016-02-291-0/+11
| | | | | | The original wrapper existed and should be been removed, this fix now ensures the TextComment removes the Comment wrapper to prevent the deleted (comments which are tombstones) existing.
* Simply for the Notification.object_id migrationJessica Tallon2016-02-291-10/+0
|
* Missing perensJessica Tallon2016-02-291-1/+3
|
* Fixed issue introduced in previous migrationJessica Tallon2016-02-291-0/+39
|
* Change Notification.object_id to be ID of Comemnt not TextCommentJessica Tallon2016-02-291-0/+72
| | | | | | | | This shouldn't really effect much but it is a needed change for the future this changes the Notification.object_id to be the ID of the Comment (the link table to the comment object) rather than TextComment (the comment object itself). This is needed as now comments can be other things, other than TextComment.
* do not show error message when it's not a exceptionBoris Bobrov2016-02-231-1/+1
| | | | | | | | Gah, the previous patch was not enough! We cannot use text, we can only use exception with a special attribute. Lets return safe None for now an resolve this properly later, when we're not in the freeze.
* Catch import error when text is used as a reason instead of pathBoris Bobrov2016-02-231-1/+11
| | | | | | | | fail_error was used in import, but due to some changes text could appear there and it caused an error. There is little sense now to remove these text messages because they are probably in databases already, so just ignore import errors.
* Fix issue #5411 sqlite connection closesAndrew Browning2016-02-232-2/+4
| | | | | This update changes migrations to wrap db.execute results in a list to keep the connection from closing for sqlite migrations.
* Display type icon in thumbnailsBoris Bobrov2016-02-051-4/+13
|
* Fix #5398 and #5395 - Fix tests failing due to problem creating connection ↵Jessica Tallon2016-01-202-13/+12
| | | | | | | | | | | | | | | for alembic For some reason the alembic connection wasn't seeing any tables that existed however the existing connection works well and we shouldn't be creating a brand new one when we have one ready to use. I've used a little bit of a hack due to our old version of alembic. After 0.7.5 of alembic it offers a `Config.attributes` dictionary which is designed to allow you to pass your connection/engine/whatever to the env.py config script so you're not required to create new ones. As we're on an older version I just create a dictionary with the same name and use it as otherwise documented. It seems this is the suggested fix for #5395 and it fixes #5398 too.
* Fix #5390 - Create migration to delete Notifications and fix ReportJessica Tallon2016-01-203-4/+81
| | | | | | | When a user deleted media or other objects any notificationn objects or reports would cause errors as the object doesn't exist anymore. This now removes them or sets them to None as expected by the code. This also adds some code to the base deletion code to make sure this happens when an object is deleted.
* 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
|