init
This commit is contained in:
commit
ab2e20f7e1
72 changed files with 2000 additions and 0 deletions
44
Femto.Database/Migrations/20250425121459_Init.sql
Normal file
44
Femto.Database/Migrations/20250425121459_Init.sql
Normal file
|
@ -0,0 +1,44 @@
|
|||
-- Migration: Init
|
||||
-- Created at: 25/04/2025 12:14:59
|
||||
|
||||
CREATE SCHEMA blog;
|
||||
|
||||
CREATE TABLE blog.author
|
||||
(
|
||||
id uuid PRIMARY KEY,
|
||||
username varchar(64) UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE blog.post
|
||||
(
|
||||
id uuid PRIMARY KEY,
|
||||
content text NOT NULL,
|
||||
created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
author_id uuid NOT NULL REFERENCES blog.author (id) on DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE blog.post_media
|
||||
(
|
||||
id uuid PRIMARY KEY,
|
||||
post_id uuid NOT NULL REFERENCES blog.post (id) ON DELETE CASCADE,
|
||||
url text NOT NULL,
|
||||
ordering int NOT NULL
|
||||
);
|
||||
|
||||
CREATE TYPE outbox_status AS ENUM ('pending', 'completed', 'failed');
|
||||
|
||||
CREATE TABLE blog.outbox
|
||||
(
|
||||
|
||||
id uuid PRIMARY KEY,
|
||||
event_type text NOT NULL,
|
||||
aggregate_id uuid NOT NULL,
|
||||
payload jsonb NOT NULL,
|
||||
created_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
processed_at timestamp,
|
||||
next_retry_at timestamp,
|
||||
retry_count int DEFAULT 0 NOT NULL,
|
||||
last_error text,
|
||||
status outbox_status DEFAULT 'pending' NOT NULL
|
||||
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue