feat: add diesel setup to project

This commit is contained in:
Jef Roosens 2025-01-13 13:06:36 +01:00
parent faeebf8376
commit 18a321853a
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
14 changed files with 203 additions and 1 deletions

View file

@ -0,0 +1 @@
drop table plants;

View file

@ -0,0 +1,6 @@
create table plants (
id integer primary key not null,
name text not null,
species text not null,
description text not null
);

View file

@ -0,0 +1 @@
drop table comments;

View file

@ -0,0 +1,5 @@
create table comments (
id integer primary key not null,
plant_id integer references plants (id),
comment text not null
);

View file

@ -0,0 +1 @@
drop table events;

View file

@ -0,0 +1,9 @@
create table events (
id integer primary key not null,
plant_id integer not null
references plants (id)
on delete cascade,
event_type text not null,
date text not null,
description text not null
);

View file

@ -0,0 +1,2 @@
drop table sessions;
drop table users;

View file

@ -0,0 +1,14 @@
create table users (
id integer primary key not null,
username text unique not null,
password_hash text not null,
admin boolean not null
);
create table sessions (
id integer primary key not null,
user_id integer not null
references users (id)
on delete cascade,
unique (id, user_id)
);