fix migrations
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2024-12-08 19:16:45 +01:00
parent 899ce99bff
commit d934a700f7
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 16 additions and 2 deletions

View file

@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS urls (
id SERIAL PRIMARY KEY,
url TEXT NOT NULL,
timestamp TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS item_log (
id SERIAL PRIMARY KEY,
module TEXT NOT NULL,
name TEXT NOT NULL,
url TEXT NOT NULL,
timestamp TEXT NOT NULL,
CONSTRAINT unique_module_name_url UNIQUE (module, name, url)
);

View file

@ -29,14 +29,14 @@ impl DatabaseBackend {
.await
.unwrap(),
);
sqlx::migrate!("./migrations")
sqlx::migrate!("./migrations_postgres")
.run(postgres.as_ref().unwrap())
.await
.unwrap();
} else {
ensure_file_exists(db_url);
sqlite = Some(sqlx::sqlite::SqlitePool::connect(db_url).await.unwrap());
sqlx::migrate!("./migrations")
sqlx::migrate!("./migrations_sqlite")
.run(sqlite.as_ref().unwrap())
.await
.unwrap();