forked from lavina/lavina
Compare commits
6 Commits
317d0d45b0
...
84c93b7cf1
Author | SHA1 | Date |
---|---|---|
caffeinatedgaze | 84c93b7cf1 | |
Mikhail | 38fe8ba539 | |
Mikhail | d347af4bae | |
Mikhail | b122987a17 | |
Mikhail | d7bb8121e8 | |
Mikhail | 0d53175b5d |
|
@ -2,3 +2,4 @@
|
||||||
/db.sqlite
|
/db.sqlite
|
||||||
.idea/
|
.idea/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
certs/
|
||||||
|
|
|
@ -19,6 +19,7 @@ repos:
|
||||||
- --all
|
- --all
|
||||||
types: [ rust ]
|
types: [ rust ]
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
|
||||||
- id: check
|
- id: check
|
||||||
name: check
|
name: check
|
||||||
description: Check
|
description: Check
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE messages
|
||||||
|
(
|
||||||
|
room_id INTEGER NOT NULL,
|
||||||
|
id INTEGER NOT NULL, -- unique per room, sequential in one room
|
||||||
|
content STRING NOT NULL,
|
||||||
|
PRIMARY KEY (room_id, id)
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
PRIMARY KEY (user_id, room_id)
|
||||||
|
);
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE messages
|
||||||
|
ADD author_id INTEGER NULL REFERENCES users (id);
|
|
@ -1,31 +0,0 @@
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
create table messages(
|
|
||||||
room_id integer not null,
|
|
||||||
id integer not null, -- unique per room, sequential in one room
|
|
||||||
content string not null,
|
|
||||||
primary key (room_id, id)
|
|
||||||
);
|
|
||||||
|
|
||||||
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
|
|
||||||
primary key (user_id, room_id)
|
|
||||||
);
|
|
|
@ -1 +0,0 @@
|
||||||
alter table messages add author_id integer null references users(id);
|
|
|
@ -1 +0,0 @@
|
||||||
alter table messages add column created_at text;
|
|
Loading…
Reference in New Issue