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

« back to all changes in this revision

Viewing changes to src/backends/db/schemas/storage/patch_6.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
 
"""Support for REST Resumable Uploads."""
20
 
 
21
 
SQL = [
22
 
    """
23
 
    CREATE TABLE resumable_upload (
24
 
        upload_id uuid PRIMARY KEY NOT NULL,
25
 
        owner_id integer NOT NULL REFERENCES StorageUserInfo ON DELETE CASCADE,
26
 
        volume_path text NOT NULL,
27
 
        size bigint NOT NULL,
28
 
        mimetype text,
29
 
        when_started timestamp without time zone
30
 
            default timezone('UTC'::text, now()) not null,
31
 
        when_last_active timestamp without time zone
32
 
            default timezone('UTC'::text, now()) not null,
33
 
        status lifecycle_status default 'Live'::lifecycle_status not null,
34
 
        storage_key uuid NOT NULL,
35
 
        part_count bigint NOT NULL,
36
 
        uploaded_bytes bigint NOT NULL,
37
 
        hash_context bytea,
38
 
        magic_hash_context bytea,
39
 
        crc_context int
40
 
    );
41
 
    """,
42
 
    """
43
 
    COMMENT ON TABLE resumable_upload IS
44
 
        'Tracks resumable upload that will result in a \
45
 
         ContentBlob being created'
46
 
    """,
47
 
    """
48
 
    COMMENT ON COLUMN resumable_upload.upload_id IS
49
 
        'Unique identifier for the upload attempt';
50
 
    """,
51
 
    """
52
 
    COMMENT ON COLUMN resumable_upload.owner_id IS
53
 
        'The id of the owner of the file';
54
 
    """,
55
 
    """
56
 
    COMMENT ON COLUMN resumable_upload.volume_path IS
57
 
        'The volume path for the file which will be created';
58
 
    """,
59
 
    """
60
 
    COMMENT ON COLUMN resumable_upload.size IS
61
 
        'The size in bytes of the file being uploaded';
62
 
    """,
63
 
    """
64
 
    COMMENT ON COLUMN resumable_upload.when_started IS
65
 
        'Timestamp when this upload started';
66
 
    """,
67
 
    """
68
 
    COMMENT ON COLUMN resumable_upload.when_last_active IS
69
 
        'Timestamp for when the last chunk was created for this upload action';
70
 
    """,
71
 
    """
72
 
    COMMENT ON COLUMN resumable_upload.storage_key IS
73
 
        'The objectName which will be created by this upload';
74
 
    """,
75
 
    """
76
 
    COMMENT ON COLUMN resumable_upload.part_count IS
77
 
        'The number of parts uploaded so far';
78
 
    """,
79
 
    """
80
 
    COMMENT ON COLUMN resumable_upload.uploaded_bytes IS
81
 
        'The number of bytes uploaded so far';
82
 
    """,
83
 
    """
84
 
    COMMENT ON COLUMN resumable_upload.hash_context IS
85
 
        'The state of the resumable hasher';
86
 
    """,
87
 
    """
88
 
    COMMENT ON COLUMN resumable_upload.magic_hash_context IS
89
 
        'The state of the resumable magic hasher';
90
 
    """,
91
 
    """
92
 
    COMMENT ON COLUMN resumable_upload.crc_context IS
93
 
        'The state of the resumable compressor';
94
 
    """,
95
 
    """
96
 
    CREATE INDEX resumable_upload_owner_idx ON resumable_upload(owner_id);
97
 
    """,
98
 
]
99
 
 
100
 
 
101
 
def apply(store):
102
 
    """Apply the patch."""
103
 
    for sql in SQL:
104
 
        store.execute(sql)