Commit | Line | Data |
---|---|---|
70b44584 | 1 | # GNU MediaGoblin -- federated, autonomous media hosting |
b781c3c9 | 2 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. |
70b44584 CAW |
3 | # |
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
38c6d441 | 17 | from sqlalchemy import MetaData, Table, Column, Boolean |
b781c3c9 JK |
18 | |
19 | from mediagoblin.db.sql.util import RegisterMigration | |
20 | ||
21 | ||
3ea1cf36 | 22 | MIGRATIONS = {} |
b781c3c9 JK |
23 | |
24 | ||
25 | @RegisterMigration(1, MIGRATIONS) | |
26 | def ogg_to_webm_audio(db_conn): | |
27 | metadata = MetaData(bind=db_conn.bind) | |
28 | ||
29 | file_keynames = Table('core__file_keynames', metadata, autoload=True, | |
30 | autoload_with=db_conn.bind) | |
31 | ||
32 | db_conn.execute( | |
38c6d441 | 33 | file_keynames.update().where(file_keynames.c.name == 'ogg'). |
b781c3c9 JK |
34 | values(name='webm_audio') |
35 | ) | |
38c6d441 JW |
36 | |
37 | ||
38 | @RegisterMigration(2, MIGRATIONS) | |
39 | def add_wants_notification_column(db_conn): | |
40 | metadata = MetaData(bind=db_conn.bind) | |
41 | ||
42 | users = Table('core__users', metadata, autoload=True, | |
43 | autoload_with=db_conn.bind) | |
44 | ||
45 | col = Column('wants_comment_notification', Boolean, | |
c4869eff | 46 | default=True, nullable=True) |
38c6d441 | 47 | col.create(users, populate_defaults=True) |