feat: add diesel setup to project
This commit is contained in:
parent
faeebf8376
commit
18a321853a
14 changed files with 203 additions and 1 deletions
1
migrations/2025-01-13-114912_create_plants/down.sql
Normal file
1
migrations/2025-01-13-114912_create_plants/down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
drop table plants;
|
||||
6
migrations/2025-01-13-114912_create_plants/up.sql
Normal file
6
migrations/2025-01-13-114912_create_plants/up.sql
Normal 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
|
||||
);
|
||||
1
migrations/2025-01-13-115415_create_comments/down.sql
Normal file
1
migrations/2025-01-13-115415_create_comments/down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
drop table comments;
|
||||
5
migrations/2025-01-13-115415_create_comments/up.sql
Normal file
5
migrations/2025-01-13-115415_create_comments/up.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
create table comments (
|
||||
id integer primary key not null,
|
||||
plant_id integer references plants (id),
|
||||
comment text not null
|
||||
);
|
||||
1
migrations/2025-01-13-115505_create_events/down.sql
Normal file
1
migrations/2025-01-13-115505_create_events/down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
drop table events;
|
||||
9
migrations/2025-01-13-115505_create_events/up.sql
Normal file
9
migrations/2025-01-13-115505_create_events/up.sql
Normal 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
|
||||
);
|
||||
2
migrations/2025-01-13-115534_add_auth/down.sql
Normal file
2
migrations/2025-01-13-115534_add_auth/down.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
drop table sessions;
|
||||
drop table users;
|
||||
14
migrations/2025-01-13-115534_add_auth/up.sql
Normal file
14
migrations/2025-01-13-115534_add_auth/up.sql
Normal 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)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue