fix: create tables only if they do not exist

This commit is contained in:
Mariano Riefolo 2024-08-10 12:05:34 +02:00
parent 9cf526456a
commit ac11a8ee5b

View File

@ -2,7 +2,7 @@ use rusqlite::{Connection, Result};
pub fn init(conn: &Connection) -> Result<()> {
conn.execute(
"CREATE TABLE accounts (
"CREATE TABLE IF NOT EXISTS accounts (
id INTEGER PRIMARY KEY,
username TEXT,
email TEXT,
@ -12,7 +12,7 @@ pub fn init(conn: &Connection) -> Result<()> {
)?;
conn.execute(
"CREATE TABLE scripts (
"CREATE TABLE IF NOT EXISTS scripts (
id INTEGER PRIMARY KEY,
name TEXT,
last_edit DATETIME DEFAULT CURRENT_TIMESTAMP,