fixed table names on FOREIGN KEY references (should also use plurals as tables was renamed)

This commit is contained in:
gulliver 2021-05-30 23:20:55 +02:00
parent dfdec4d8a7
commit 5aebc32e87
2 changed files with 16 additions and 8 deletions

View File

@ -18,8 +18,8 @@ CREATE TABLE IF NOT EXISTS user_skills (
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
skill_id INTEGER OT NULL, skill_id INTEGER OT NULL,
level INTEGER, level INTEGER,
FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(user_id) REFERENCES users(id),
FOREIGN KEY(skill_id) REFERENCES skill(id) FOREIGN KEY(skill_id) REFERENCES skills(id)
); );
CREATE TABLE IF NOT EXISTS user_languages ( CREATE TABLE IF NOT EXISTS user_languages (
@ -28,8 +28,8 @@ CREATE TABLE IF NOT EXISTS user_languages (
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
language_id INTEGER NOT NULL, language_id INTEGER NOT NULL,
level INTEGER, level INTEGER,
FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(user_id) REFERENCES users(id),
FOREIGN KEY(language_id) REFERENCES language(id) FOREIGN KEY(language_id) REFERENCES languages(id)
); );
CREATE TABLE IF NOT EXISTS skills ( CREATE TABLE IF NOT EXISTS skills (
@ -43,15 +43,15 @@ CREATE TABLE IF NOT EXISTS user_experiences (
description VARCHAR, description VARCHAR,
start date, start date,
end date, end date,
FOREIGN KEY (user_id) REFERENCES user(id) FOREIGN KEY (user_id) REFERENCES users(id)
); );
CREATE TABLE IF NOT EXISTS user_search_topics ( CREATE TABLE IF NOT EXISTS user_search_topics (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
topic_id INTEGER NOT NULL, topic_id INTEGER NOT NULL,
FOREIGN KEY (user_id) REFERENCES user(id), FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (topic_id) REFERENCES topic(id) FOREIGN KEY (topic_id) REFERENCES topics(id)
); );
CREATE TABLE IF NOT EXISTS user_contacts ( CREATE TABLE IF NOT EXISTS user_contacts (
@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS user_contacts (
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
contact_type_id INTEGER NOT NULL, contact_type_id INTEGER NOT NULL,
content_ VARCHAR, content_ VARCHAR,
FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(user_id) REFERENCES users(id),
FOREIGN KEY (contact_type_id) REFERENCES contact_types(id) FOREIGN KEY (contact_type_id) REFERENCES contact_types(id)
); );

View File

@ -96,6 +96,14 @@ table! {
} }
joinable!(user_contacts -> contact_types (contact_type_id)); joinable!(user_contacts -> contact_types (contact_type_id));
joinable!(user_contacts -> users (user_id));
joinable!(user_experiences -> users (user_id));
joinable!(user_languages -> languages (language_id));
joinable!(user_languages -> users (user_id));
joinable!(user_search_topics -> topics (topic_id));
joinable!(user_search_topics -> users (user_id));
joinable!(user_skills -> skills (skill_id));
joinable!(user_skills -> users (user_id));
allow_tables_to_appear_in_same_query!( allow_tables_to_appear_in_same_query!(
contact_types, contact_types,