Database: schema files, pool creation + db init code
This commit is contained in:
parent
49899b6f34
commit
a3fe014592
6 changed files with 606 additions and 7 deletions
20
sql/postgres_schema.sql
Normal file
20
sql/postgres_schema.sql
Normal file
|
@ -0,0 +1,20 @@
|
|||
CREATE TABLE bundles (
|
||||
id SEQUENCE PRIMARY KEY,
|
||||
encrypted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
expires TIMESTAMPTZ DEFAULT NULL
|
||||
);
|
||||
ALTER SEQUENCE bundles_id_seq RESTART WITH -2147483648;
|
||||
|
||||
CREATE TABLE files (
|
||||
id SEQUENCE PRIMARY KEY,
|
||||
bundle INTEGER NOT NULL,
|
||||
name VARCHAR(30) NOT NULL,
|
||||
mime VARCHAR(255) NOT NULL
|
||||
);
|
||||
ALTER SEQUENCE files_id_seq RESTART WITH -2147483648;
|
||||
|
||||
CREATE TABLE links (
|
||||
shortid VARCHAR(8) PRIMARY KEY,
|
||||
target VARCHAR(2047) NOT NULL,
|
||||
encrypted BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
22
sql/sqlite_schema.sql
Normal file
22
sql/sqlite_schema.sql
Normal file
|
@ -0,0 +1,22 @@
|
|||
CREATE TABLE bundles (
|
||||
id INTEGER PRIMARY KEY,
|
||||
encrypted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
expires DATETIME DEFAULT NULL
|
||||
);
|
||||
INSERT INTO bundles (id) VALUES (-2147483648);
|
||||
DELETE FROM bundles WHERE id=-2147483648;
|
||||
|
||||
CREATE TABLE files (
|
||||
id INTEGER PRIMARY KEY,
|
||||
bundle INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
mime TEXT NOT NULL
|
||||
);
|
||||
INSERT INTO files (id, bundle, name, mime) VALUES (-2147483648, 0, "file.txt", "text/plain");
|
||||
DELETE FROM files WHERE id=-2147483648;
|
||||
|
||||
CREATE TABLE links (
|
||||
shortid TEXT PRIMARY KEY,
|
||||
target TEXT NOT NULL,
|
||||
encrypted BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue