all tablenames are now in their plural form (e.g. user -> users)
This commit is contained in:
parent
a5c25e4abc
commit
f34d59dec9
@ -1 +1,20 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE IF EXISTS users;
|
||||
|
||||
DROP TABLE IF EXISTS user_skills;
|
||||
|
||||
DROP TABLE IF EXISTS user_languages;
|
||||
|
||||
DROP TABLE IF EXISTS skills;
|
||||
|
||||
DROP TABLE IF EXISTS user_experiences;
|
||||
DROP TABLE IF EXISTS user_search_topics;
|
||||
|
||||
DROP TABLE IF EXISTS user_contacts;
|
||||
|
||||
DROP TABLE IF EXISTS topics;
|
||||
|
||||
DROP TABLE IF EXISTS languages;
|
||||
|
||||
DROP TABLE IF EXISTS experiences;
|
||||
|
||||
DROP TABLE IF EXISTS contact_types;
|
||||
|
@ -1,4 +1,4 @@
|
||||
CREATE TABLE IF NOT EXISTS user (
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
nickname VARCHAR,
|
||||
pronouns VARCHAR,
|
||||
@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS user (
|
||||
Freitext VARCHAR
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_skill (
|
||||
CREATE TABLE IF NOT EXISTS user_skills (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
skill_id INTEGER OT NULL,
|
||||
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS user_skill (
|
||||
FOREIGN KEY(skill_id) REFERENCES skill(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_language (
|
||||
CREATE TABLE IF NOT EXISTS user_languages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
user_id INTEGER NOT NULL,
|
||||
@ -32,12 +32,12 @@ CREATE TABLE IF NOT EXISTS user_language (
|
||||
FOREIGN KEY(language_id) REFERENCES language(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS skill (
|
||||
CREATE TABLE IF NOT EXISTS skills (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name VARCHAR
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_experience (
|
||||
CREATE TABLE IF NOT EXISTS user_experiences (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
description VARCHAR,
|
||||
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS user_experience (
|
||||
FOREIGN KEY (user_id) REFERENCES user(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_search_topic (
|
||||
CREATE TABLE IF NOT EXISTS user_search_topics (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
topic_id INTEGER NOT NULL,
|
||||
@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS user_search_topic (
|
||||
FOREIGN KEY (topic_id) REFERENCES topic(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_contact (
|
||||
CREATE TABLE IF NOT EXISTS user_contacts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
contact_type_id INTEGER NOT NULL,
|
||||
@ -63,17 +63,17 @@ CREATE TABLE IF NOT EXISTS user_contact (
|
||||
FOREIGN KEY (contact_type_id) REFERENCES contact_types(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS topic (
|
||||
CREATE TABLE IF NOT EXISTS topics (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name VARCHAR
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS language (
|
||||
CREATE TABLE IF NOT EXISTS languages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name VARCHAR
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS experience (
|
||||
CREATE TABLE IF NOT EXISTS experiences (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name VARCHAR
|
||||
);
|
||||
|
@ -6,35 +6,80 @@ table! {
|
||||
}
|
||||
|
||||
table! {
|
||||
experience (id) {
|
||||
experiences (id) {
|
||||
id -> Nullable<Integer>,
|
||||
name -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
language (id) {
|
||||
languages (id) {
|
||||
id -> Nullable<Integer>,
|
||||
name -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
skill (id) {
|
||||
skills (id) {
|
||||
id -> Nullable<Integer>,
|
||||
name -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
topic (id) {
|
||||
topics (id) {
|
||||
id -> Nullable<Integer>,
|
||||
name -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user (id) {
|
||||
user_contacts (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
contact_type_id -> Integer,
|
||||
content_ -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_experiences (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
description -> Nullable<Text>,
|
||||
start -> Nullable<Date>,
|
||||
end -> Nullable<Date>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_languages (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
language_id -> Integer,
|
||||
level -> Nullable<Integer>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_search_topics (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
topic_id -> Integer,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_skills (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
skill_id -> Nullable<Integer>,
|
||||
level -> Nullable<Integer>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
users (id) {
|
||||
id -> Nullable<Integer>,
|
||||
nickname -> Nullable<Text>,
|
||||
pronouns -> Nullable<Text>,
|
||||
@ -50,71 +95,18 @@ table! {
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_contact (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
contact_type_id -> Integer,
|
||||
content_ -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_experience (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
description -> Nullable<Text>,
|
||||
start -> Nullable<Date>,
|
||||
end -> Nullable<Date>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_language (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
language_id -> Integer,
|
||||
level -> Nullable<Integer>,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_search_topic (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
topic_id -> Integer,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
user_skill (id) {
|
||||
id -> Nullable<Integer>,
|
||||
user_id -> Integer,
|
||||
skill_id -> Nullable<Integer>,
|
||||
level -> Nullable<Integer>,
|
||||
}
|
||||
}
|
||||
|
||||
joinable!(user_contact -> contact_types (contact_type_id));
|
||||
joinable!(user_contact -> user (user_id));
|
||||
joinable!(user_experience -> user (user_id));
|
||||
joinable!(user_language -> language (language_id));
|
||||
joinable!(user_language -> user (user_id));
|
||||
joinable!(user_search_topic -> topic (topic_id));
|
||||
joinable!(user_search_topic -> user (user_id));
|
||||
joinable!(user_skill -> skill (skill_id));
|
||||
joinable!(user_skill -> user (user_id));
|
||||
joinable!(user_contacts -> contact_types (contact_type_id));
|
||||
|
||||
allow_tables_to_appear_in_same_query!(
|
||||
contact_types,
|
||||
experience,
|
||||
language,
|
||||
skill,
|
||||
topic,
|
||||
user,
|
||||
user_contact,
|
||||
user_experience,
|
||||
user_language,
|
||||
user_search_topic,
|
||||
user_skill,
|
||||
experiences,
|
||||
languages,
|
||||
skills,
|
||||
topics,
|
||||
user_contacts,
|
||||
user_experiences,
|
||||
user_languages,
|
||||
user_search_topics,
|
||||
user_skills,
|
||||
users,
|
||||
);
|
||||
|
7
model/sqlite3/src/lib.rs
Normal file
7
model/sqlite3/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user