You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
1.1 KiB

CREATE TABLE `articles` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`title` text(255) NOT NULL,
`content` text NOT NULL,
`summary` text,
`cover` text(500),
`status` text DEFAULT 'draft' NOT NULL,
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL
);
--> statement-breakpoint
CREATE INDEX `idx_article_status` ON `articles` (`status`);--> statement-breakpoint
CREATE INDEX `idx_article_created` ON `articles` (`created_at`);--> statement-breakpoint
CREATE TABLE `article_cards` (
`article_id` integer NOT NULL,
`card_id` integer NOT NULL,
`sort_order` integer DEFAULT 0 NOT NULL,
PRIMARY KEY(`article_id`, `card_id`),
FOREIGN KEY (`article_id`) REFERENCES `articles`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`card_id`) REFERENCES `cards`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `idx_article_card_article` ON `article_cards` (`article_id`);--> statement-breakpoint
CREATE INDEX `idx_article_card_card` ON `article_cards` (`card_id`);