add items table schema
This commit is contained in:
parent
689b67ca74
commit
c82ed40251
1
migrations/2020-02-21-011449_create_items/down.sql
Normal file
1
migrations/2020-02-21-011449_create_items/down.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DROP TABLE items
|
13
migrations/2020-02-21-011449_create_items/up.sql
Normal file
13
migrations/2020-02-21-011449_create_items/up.sql
Normal 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)
|
||||
)
|
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue