About and database table to convert for the orm
This commit is contained in:
12
database/schemas/blog.sql
Normal file
12
database/schemas/blog.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE blogs (
|
||||
uuid UUID PRIMARY KEY, -- The blog primary key
|
||||
slug VARCHAR(255) UNIQUE NOT NULL, -- Slug must be unique and non-null
|
||||
content TEXT NOT NULL, -- Content cannot be null
|
||||
label VARCHAR(100), -- Optional label
|
||||
author UUID REFERENCES users(user_id) ON DELETE SET NULL, -- Foreign key to user with cascading null for author deletion
|
||||
published TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Automatically set the published time
|
||||
summary VARCHAR(500), -- A brief summary of the blog
|
||||
image VARCHAR(255), -- URL for the blog image
|
||||
href VARCHAR(255), -- Link to the blog if external
|
||||
CONSTRAINT check_slug_length CHECK (length(slug) > 0) -- Ensure slug is not empty
|
||||
);
|
||||
Reference in New Issue
Block a user