diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2017-11-27 12:25:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-27 12:25:48 +0000 |
commit | 5a4da5bf784669e0b0263279b7a0b0804026348f (patch) | |
tree | d8d9d2597243e1304bee0fe6e80e4c5aaf0710a0 /synapse/storage/media_repository.py | |
parent | Merge pull request #2713 from matrix-org/rav/no_upsert_forever (diff) | |
parent | fix sql fails (diff) | |
download | synapse-5a4da5bf784669e0b0263279b7a0b0804026348f.tar.xz |
Merge pull request #2697 from matrix-org/rav/fix_urlcache_index_error
Fix error on sqlite 3.7
Diffstat (limited to 'synapse/storage/media_repository.py')
-rw-r--r-- | synapse/storage/media_repository.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/synapse/storage/media_repository.py b/synapse/storage/media_repository.py index 52e5cdad70..a66ff7c1e0 100644 --- a/synapse/storage/media_repository.py +++ b/synapse/storage/media_repository.py @@ -12,13 +12,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from synapse.storage.background_updates import BackgroundUpdateStore -from ._base import SQLBaseStore - -class MediaRepositoryStore(SQLBaseStore): +class MediaRepositoryStore(BackgroundUpdateStore): """Persistence for attachments and avatars""" + def __init__(self, db_conn, hs): + super(MediaRepositoryStore, self).__init__(db_conn, hs) + + self.register_background_index_update( + update_name='local_media_repository_url_idx', + index_name='local_media_repository_url_idx', + table='local_media_repository', + columns=['created_ts'], + where_clause='url_cache IS NOT NULL', + ) + def get_default_thumbnails(self, top_level_type, sub_type): return [] |