add tags
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
DROP TABLE IF EXISTS file_tags;
|
||||
|
||||
DROP TABLE IF EXISTS tags;
|
||||
@@ -0,0 +1,19 @@
|
||||
-- VaultDrop 003: tags table
|
||||
|
||||
CREATE TABLE tags (
|
||||
id TEXT PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
|
||||
parent_tag_id TEXT,
|
||||
tag_name TEXT NOT NULL, -- exemple: Brice, vélo, facture ...
|
||||
tag_type TEXT NOT NULL DEFAULT 'none', -- exemple: entity, none, folder
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_parent_tag FOREIGN KEY(parent_tag_id) REFERENCES tags(id)
|
||||
);
|
||||
|
||||
CREATE TABLE file_tags (
|
||||
id TEXT PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
|
||||
tag_id TEXT,
|
||||
file_id TEXT,
|
||||
CONSTRAINT fk_tag FOREIGN KEY(tag_id) REFERENCES tags(id),
|
||||
CONSTRAINT fk_file FOREIGN KEY(file_id) REFERENCES files(id)
|
||||
)
|
||||
Reference in New Issue
Block a user