Update schema to include default contents sql file.
This commit is contained in:
parent
2ebe37f8e7
commit
18d4d27183
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
database/default-content.sql
|
||||||
vendor
|
vendor
|
||||||
node_modules
|
node_modules
|
||||||
database/origo.db
|
database/origo.db
|
||||||
|
|||||||
15
database/default-content-example.sql
Normal file
15
database/default-content-example.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
INSERT INTO users (username, email, password) VALUES
|
||||||
|
('someUsername', 'some@email.com', 'passwordHash');
|
||||||
|
|
||||||
|
INSERT INTO permissions (user_id, permission) VALUES
|
||||||
|
(1, 'admin');
|
||||||
|
|
||||||
|
INSERT INTO accounts (account_id) VALUES ("<some account id value>");
|
||||||
|
|
||||||
|
INSERT INTO user_accounts (user_id, account_id) VALUES (1,"<match account id above>");
|
||||||
|
|
||||||
|
INSERT INTO tasks (user_id, task, description, status, external_url) VALUES
|
||||||
|
(1, 'Buy milk', 'this task requires you to go to the store and buy milk.', 'pending', 'https://www.google.com');
|
||||||
|
|
||||||
|
INSERT INTO tasks (user_id, task, description, status, external_url) VALUES
|
||||||
|
(1, 'Buy eggs', 'this task requires you to go to the store and buy eggs.', 'pending', 'https://www.google.com');
|
||||||
@ -73,18 +73,3 @@ ON pageviews(created_at);
|
|||||||
CREATE INDEX IF NOT EXISTS idx_pageviews_account_time
|
CREATE INDEX IF NOT EXISTS idx_pageviews_account_time
|
||||||
ON pageviews(account_id, created_at);
|
ON pageviews(account_id, created_at);
|
||||||
|
|
||||||
INSERT INTO users (username, email, password) VALUES
|
|
||||||
('bender', 'dan@danchadwickdesign.com', 'aa7101dc6e2fe541ac5a44352c24d15052723b70ceecd5fc6d7fe71d0721c9aa');
|
|
||||||
|
|
||||||
INSERT INTO permissions (user_id, permission) VALUES
|
|
||||||
(1, 'admin');
|
|
||||||
|
|
||||||
INSERT INTO accounts (account_id) VALUES ("3116a529b262b9f3cc08a4ba87d5d833");
|
|
||||||
|
|
||||||
INSERT INTO user_accounts (user_id, account_id) VALUES (1,"3116a529b262b9f3cc08a4ba87d5d833");
|
|
||||||
|
|
||||||
INSERT INTO tasks (user_id, task, description, status, external_url) VALUES
|
|
||||||
(1, 'Buy milk', 'this task requires you to go to the store and buy milk.', 'pending', 'https://www.google.com');
|
|
||||||
|
|
||||||
INSERT INTO tasks (user_id, task, description, status, external_url) VALUES
|
|
||||||
(1, 'Buy eggs', 'this task requires you to go to the store and buy eggs.', 'pending', 'https://www.google.com');
|
|
||||||
|
|||||||
@ -4,3 +4,9 @@
|
|||||||
rm database/origo.db
|
rm database/origo.db
|
||||||
# Import the schema for the new database.
|
# Import the schema for the new database.
|
||||||
sqlite3 database/origo.db < database/schema.sql
|
sqlite3 database/origo.db < database/schema.sql
|
||||||
|
|
||||||
|
# Check if there is a default content sql file.
|
||||||
|
if [ -f database/default-content.sql ]; then
|
||||||
|
# Import the default content for the new database.
|
||||||
|
sqlite3 database/origo.db < database/default-content.sql
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user