diff --git a/crates/lavina-core/migrations/0000_first.sql b/crates/lavina-core/migrations/0000_first.sql index 4c28baf..971c05d 100644 --- a/crates/lavina-core/migrations/0000_first.sql +++ b/crates/lavina-core/migrations/0000_first.sql @@ -1,27 +1,29 @@ -CREATE TABLE users ( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, +CREATE TABLE users +( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name STRING UNIQUE NOT NULL ); -- for development only, replace with properly hashed passwords later CREATE TABLE challenges_plain_password ( - user_id INTEGER PRIMARY KEY NOT NULL, - password STRING NOT NULL + user_id INTEGER PRIMARY KEY NOT NULL, + password STRING NOT NULL ); CREATE TABLE rooms ( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - name STRING UNIQUE NOT NULL, - topic STRING NOT NULL, - message_count INTEGER NOT NULL DEFAULT 0 + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + name STRING UNIQUE NOT NULL, + topic STRING NOT NULL, + message_count INTEGER NOT NULL DEFAULT 0 ); -CREATE TABLE messages ( +CREATE TABLE messages +( room_id INTEGER NOT NULL, - id INTEGER NOT NULL, -- unique per room, sequential in one room - content STRING NOT NULL, + id INTEGER NOT NULL, -- unique per room, sequential in one room + content STRING NOT NULL, PRIMARY KEY (room_id, id) ); @@ -29,6 +31,6 @@ CREATE TABLE memberships ( user_id INTEGER NOT NULL, room_id INTEGER NOT NULL, - status INTEGER NOT NULL, -- 0 for not-joined, 1 for joined, 2 for banned + status INTEGER NOT NULL, -- 0 for not-joined, 1 for joined, 2 for banned PRIMARY KEY (user_id, room_id) ); diff --git a/crates/lavina-core/migrations/0001_msg_author.sql b/crates/lavina-core/migrations/0001_msg_author.sql index 91509ea..7e5c5cb 100644 --- a/crates/lavina-core/migrations/0001_msg_author.sql +++ b/crates/lavina-core/migrations/0001_msg_author.sql @@ -1 +1,2 @@ -ALTER TABLE messages ADD author_id INTEGER NULL REFERENCES users (id); -- noqa: PRS \ No newline at end of file +ALTER TABLE messages + ADD author_id INTEGER NULL REFERENCES users (id); diff --git a/crates/lavina-core/migrations/0002_msg_timestamps_to_stored_history.sql b/crates/lavina-core/migrations/0002_msg_timestamps_to_stored_history.sql index 8ddc1d3..e69de29 100644 --- a/crates/lavina-core/migrations/0002_msg_timestamps_to_stored_history.sql +++ b/crates/lavina-core/migrations/0002_msg_timestamps_to_stored_history.sql @@ -1 +0,0 @@ --- Add migration script here