Run DB migrations on startup

This commit is contained in:
2024-07-06 11:41:55 -06:00
parent c9f7675308
commit c7344a9e37
4 changed files with 101 additions and 20 deletions

View File

@ -0,0 +1,6 @@
create table node (
id INT PRIMARY KEY,
title TEXT NOT NULL,
body TEXT NOT NULL
);
insert into node(title, body) values ("First post", "This is the beginning of a beautiful relationship.");

View File

@ -0,0 +1,9 @@
create table node_type (
id INT PRIMARY KEY,
name TEXT NOT NULL
);
insert into node_type(id, name) values (0, "Basic post");
alter table node
add column node_type_id INT NOT NULL references node_type(id) default 0;