oxicloud/migrations/20231220211536_shares.sql
2024-04-11 21:14:09 +02:00

19 lines
725 B
SQL

-- Add migration script here
CREATE TABLE user_shares (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
created_by INT UNSIGNED NOT NULL,
src_user INT UNSIGNED NOT NULL,
src_path TEXT NOT NULL,
dst_user INT UNSIGNED NOT NULL,
dst_path TEXT NOT NULL,
expires_at DATETIME NULL,
note TEXT NOT NULL,
permissions TINYINT UNSIGNED NOT NULL,
PRIMARY KEY (id),
CONSTRAINT fk_user_shares_src FOREIGN KEY (src_user) REFERENCES users(id) ON DELETE CASCADE,
CONSTRAINT fk_user_shares_dst FOREIGN KEY (dst_user) REFERENCES users(id) ON DELETE CASCADE,
CONSTRAINT fk_user_shares_created_by FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE CASCADE,
FULLTEXT (src_path, dst_path)
);