Fixed databse init function

This commit is contained in:
Lukian 2024-12-06 01:30:34 +01:00
parent 902e96b205
commit 8f8fc0c46e
3 changed files with 13 additions and 8 deletions

View file

@ -1,9 +1,14 @@
use sqlite::{Connection, State, Error};
use sqlite::{Connection, OpenFlags};
pub fn init() -> sqlite::Result<()> {
let conn = Connection::open("./data/data.db")?;
let conn = Connection::open_with_flags(
"./data/data.db",
OpenFlags::new()
.with_create()
.with_read_write()
);
conn.execute(
conn?.execute(
"CREATE TABLE IF NOT EXISTS articles (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,