I did some stuff with getting it set up and changing photos but i can't get the sqlite to work on prod
This commit is contained in:
@@ -4,6 +4,28 @@ import { dev } from '$app/environment';
|
||||
// Initialize the database
|
||||
const db = new Database(dev ? 'dev.db' : 'prod.db', { create: true});
|
||||
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
`);
|
||||
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
'pork_cuts' (
|
||||
'id' integer not null primary key autoincrement,
|
||||
'name' varchar(40) null,
|
||||
'raw_cut' BOOLEAN null,
|
||||
'stock' INT null default 0,
|
||||
"preweighed" BOOLEAN NULL,
|
||||
"min_weight" DOUBLE NULL,
|
||||
"max_weight" DOUBLE NULL,
|
||||
unique ('id')
|
||||
)
|
||||
`);
|
||||
|
||||
// Close the database connection when the application shuts down
|
||||
process.on('SIGINT', () => {
|
||||
|
||||
Reference in New Issue
Block a user