~facundo/magicicada-server/better-settings-local

« back to all changes in this revision

Viewing changes to src/backends/db/schemas/storage/patch_4.py

  • Committer: Magicicada Bot
  • Author(s): Natalia
  • Date: 2016-05-23 12:25:55 UTC
  • mfrom: (60.1.4 clean-storms)
  • Revision ID: magicicada_bot-20160523122555-nol7mgyv60kmkty2
[r=facundo] - Remove all storm-related bits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2008-2015 Canonical
2
 
# Copyright 2015 Chicharreros (https://launchpad.net/~chicharreros)
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
6
 
# published by the Free Software Foundation, either version 3 of the
7
 
# License, or (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
 
#
17
 
# For further info, check  http://launchpad.net/magicicada-server
18
 
 
19
 
"""Drop a couple columns that are no longer used for a long time."""
20
 
 
21
 
SQL = [
22
 
    """
23
 
    ALTER TABLE storageuserinfo DROP COLUMN pre_gen_client;
24
 
    """,
25
 
    """
26
 
    DROP VIEW share_delta_view;
27
 
    """,
28
 
    """
29
 
    CREATE VIEW share_delta_view AS
30
 
        SELECT NULL::unknown AS share_id, o.id, o.owner_id,
31
 
        o.volume_id, o.parent_id, o.name, o.content_hash, o.directory_hash,
32
 
        o.kind, o.mimetype, o.when_created, o.when_last_modified, o.status,
33
 
        o.path, o.publicfile_id, o.public_uuid, o.generation,
34
 
        o.generation_created
35
 
        FROM object o
36
 
    UNION
37
 
        SELECT movefromshare.share_id, movefromshare.id,
38
 
        movefromshare.owner_id, movefromshare.volume_id,
39
 
        movefromshare.parent_id, movefromshare.name,
40
 
        movefromshare.content_hash, movefromshare.directory_hash,
41
 
        movefromshare.kind, movefromshare.mimetype, movefromshare.when_created,
42
 
        movefromshare.when_last_modified, movefromshare.status,
43
 
        movefromshare.path,
44
 
        movefromshare.publicfile_id, movefromshare.public_uuid,
45
 
        movefromshare.generation, movefromshare.generation_created
46
 
        FROM movefromshare;
47
 
    """,
48
 
    """
49
 
    ALTER TABLE object DROP COLUMN is_public;
50
 
    """,
51
 
]
52
 
 
53
 
 
54
 
def apply(store):
55
 
    """Apply the patch."""
56
 
    for sql in SQL:
57
 
        store.execute(sql)