add items table schema

This commit is contained in:
Peter Cai 2020-02-21 09:22:53 +08:00
parent 689b67ca74
commit c82ed40251
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1 @@
DROP TABLE items

View File

@ -0,0 +1,13 @@
CREATE TABLE items (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
owner INTEGER NOT NULL,
uuid VARCHAR NOT NULL,
content VARCHAR,
content_type VARCHAR NOT NULL,
enc_item_key VARCHAR,
deleted BOOLEAN NOT NULL,
created_at DATE NOT NULL,
updated_at DATE NOT NULL,
FOREIGN KEY (owner)
REFERENCES users (id)
)

View File

@ -1,3 +1,17 @@
table! {
items (id) {
id -> Integer,
owner -> Integer,
uuid -> Text,
content -> Nullable<Text>,
content_type -> Text,
enc_item_key -> Nullable<Text>,
deleted -> Bool,
created_at -> Date,
updated_at -> Date,
}
}
table! {
users (id) {
id -> Integer,
@ -8,3 +22,10 @@ table! {
version -> Text,
}
}
joinable!(items -> users (owner));
allow_tables_to_appear_in_same_query!(
items,
users,
);