You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
830 B
SQL
30 lines
830 B
SQL
CREATE TABLE tmp_filestore (
|
|
file_id integer PRIMARY KEY,
|
|
user_id integer NOT NULL,
|
|
filename varchar(128) NOT NULL,
|
|
mtime integer NOT NULL,
|
|
data text NOT NULL
|
|
);
|
|
|
|
INSERT INTO tmp_filestore (file_id, user_id, filename, mtime, data)
|
|
SELECT file_id, user_id, filename, mtime, data FROM filestore;
|
|
|
|
DROP TABLE filestore;
|
|
|
|
CREATE TABLE filestore (
|
|
file_id integer NOT NULL PRIMARY KEY,
|
|
user_id integer NOT NULL,
|
|
context varchar(32) NOT NULL,
|
|
filename varchar(128) NOT NULL,
|
|
mtime integer NOT NULL,
|
|
data text NOT NULL
|
|
);
|
|
|
|
INSERT INTO filestore (file_id, user_id, filename, mtime, data, context)
|
|
SELECT file_id, user_id, filename, mtime, data, 'enigma' FROM tmp_filestore;
|
|
|
|
CREATE UNIQUE INDEX ix_filestore_user_id ON filestore(user_id, context, filename);
|
|
|
|
DROP TABLE tmp_filestore;
|
|
|