aboutsummaryrefslogtreecommitdiffstats
path: root/sql/sqlite/patch-uploadstash-us_size_to_bigint.sql
blob: 61610e8475c049d069cc9ed5aa149bdf1d8099cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: sql/abstractSchemaChanges/patch-uploadstash-us_size_to_bigint.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__uploadstash AS
SELECT
  us_id,
  us_user,
  us_key,
  us_orig_path,
  us_path,
  us_source_type,
  us_timestamp,
  us_status,
  us_chunk_inx,
  us_props,
  us_size,
  us_sha1,
  us_mime,
  us_media_type,
  us_image_width,
  us_image_height,
  us_image_bits
FROM /*_*/uploadstash;
DROP TABLE /*_*/uploadstash;


CREATE TABLE /*_*/uploadstash (
    us_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    us_user INTEGER UNSIGNED NOT NULL,
    us_key VARCHAR(255) NOT NULL,
    us_orig_path VARCHAR(255) NOT NULL,
    us_path VARCHAR(255) NOT NULL,
    us_source_type VARCHAR(50) DEFAULT NULL,
    us_timestamp BLOB NOT NULL,
    us_status VARCHAR(50) NOT NULL,
    us_chunk_inx INTEGER UNSIGNED DEFAULT NULL,
    us_props BLOB DEFAULT NULL,
    us_size BIGINT UNSIGNED NOT NULL,
    us_sha1 VARCHAR(31) NOT NULL,
    us_mime VARCHAR(255) DEFAULT NULL,
    us_media_type TEXT DEFAULT NULL,
    us_image_width INTEGER UNSIGNED DEFAULT NULL,
    us_image_height INTEGER UNSIGNED DEFAULT NULL,
    us_image_bits SMALLINT UNSIGNED DEFAULT NULL
  );
INSERT INTO /*_*/uploadstash (
    us_id, us_user, us_key, us_orig_path,
    us_path, us_source_type, us_timestamp,
    us_status, us_chunk_inx, us_props,
    us_size, us_sha1, us_mime, us_media_type,
    us_image_width, us_image_height,
    us_image_bits
  )
SELECT
  us_id,
  us_user,
  us_key,
  us_orig_path,
  us_path,
  us_source_type,
  us_timestamp,
  us_status,
  us_chunk_inx,
  us_props,
  us_size,
  us_sha1,
  us_mime,
  us_media_type,
  us_image_width,
  us_image_height,
  us_image_bits
FROM
  /*_*/__temp__uploadstash;
DROP TABLE /*_*/__temp__uploadstash;

CREATE INDEX us_user ON /*_*/uploadstash (us_user);

CREATE UNIQUE INDEX us_key ON /*_*/uploadstash (us_key);

CREATE INDEX us_timestamp ON /*_*/uploadstash (us_timestamp);