Update schema to include default contents sql file.

This commit is contained in:
dan612 2026-01-15 09:59:34 -05:00
parent 2ebe37f8e7
commit 18d4d27183
4 changed files with 22 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
database/default-content.sql
vendor
node_modules
database/origo.db

View 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');

View File

@ -73,18 +73,3 @@ ON pageviews(created_at);
CREATE INDEX IF NOT EXISTS idx_pageviews_account_time
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');

View File

@ -4,3 +4,9 @@
rm database/origo.db
# Import the schema for the new database.
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