Add "IF NOT EXISTS" to create query
This commit is contained in:
parent
665fc7c6a7
commit
011f3ab497
|
@ -192,7 +192,7 @@ pub fn create_cache() -> Result<()> {
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"
|
"
|
||||||
CREATE TABLE config (
|
CREATE TABLE IF NOT EXISTS config (
|
||||||
name TEXT PRIMARY KEY,
|
name TEXT PRIMARY KEY,
|
||||||
value TEXT NOT NULL
|
value TEXT NOT NULL
|
||||||
)",
|
)",
|
||||||
|
@ -201,7 +201,7 @@ pub fn create_cache() -> Result<()> {
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"
|
"
|
||||||
CREATE TABLE currencies (
|
CREATE TABLE IF NOT EXISTS currencies (
|
||||||
code TEXT PRIMARY KEY,
|
code TEXT PRIMARY KEY,
|
||||||
text TEXT NOT NULL,
|
text TEXT NOT NULL,
|
||||||
next_update TIME NOT NULL
|
next_update TIME NOT NULL
|
||||||
|
@ -211,7 +211,7 @@ pub fn create_cache() -> Result<()> {
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"
|
"
|
||||||
CREATE TABLE exchange_rates (
|
CREATE TABLE IF NOT EXISTS exchange_rates (
|
||||||
code_from TEXT NOT NULL,
|
code_from TEXT NOT NULL,
|
||||||
code_to TEXT NOT NULL,
|
code_to TEXT NOT NULL,
|
||||||
rate TEXT NOT NULL,
|
rate TEXT NOT NULL,
|
||||||
|
@ -222,7 +222,7 @@ pub fn create_cache() -> Result<()> {
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"
|
"
|
||||||
INSERT INTO config (name, value) VALUES (
|
INSERT OR IGNORE INTO config (name, value) VALUES (
|
||||||
'API_KEY',
|
'API_KEY',
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
|
Reference in New Issue