관리자 기능과 태그 표시 설정 추가
This commit is contained in:
@@ -32,10 +32,21 @@ CREATE TABLE IF NOT EXISTS tags (
|
||||
name TEXT NOT NULL,
|
||||
slug TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
color TEXT NOT NULL DEFAULT '#15171a',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
ALTER TABLE tags
|
||||
ADD COLUMN IF NOT EXISTS sort_order INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE tags
|
||||
ADD COLUMN IF NOT EXISTS color TEXT NOT NULL DEFAULT '#15171a';
|
||||
|
||||
CREATE INDEX IF NOT EXISTS tags_sort_order_name_idx
|
||||
ON tags (sort_order ASC, name ASC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS post_tags (
|
||||
post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||||
tag_id UUID NOT NULL REFERENCES tags(id) ON DELETE CASCADE,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
INSERT INTO tags (id, name, slug, description)
|
||||
INSERT INTO tags (id, name, slug, description, sort_order, color)
|
||||
VALUES
|
||||
('44444444-4444-4444-8444-444444444444', 'NOTE', 'note', '생각과 기록을 모아두는 태그입니다.'),
|
||||
('55555555-5555-4555-8555-555555555555', 'DEV', 'dev', '개발과 제작 과정을 기록하는 태그입니다.')
|
||||
('44444444-4444-4444-8444-444444444444', 'NOTE', 'note', '생각과 기록을 모아두는 태그입니다.', 10, '#f97316'),
|
||||
('55555555-5555-4555-8555-555555555555', 'DEV', 'dev', '개발과 제작 과정을 기록하는 태그입니다.', 20, '#06b6d4')
|
||||
ON CONFLICT (slug) DO NOTHING;
|
||||
|
||||
INSERT INTO posts (
|
||||
|
||||
18
db/migrations/003_add_tag_display_fields.sql
Normal file
18
db/migrations/003_add_tag_display_fields.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
ALTER TABLE tags
|
||||
ADD COLUMN IF NOT EXISTS sort_order INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE tags
|
||||
ADD COLUMN IF NOT EXISTS color TEXT NOT NULL DEFAULT '#15171a';
|
||||
|
||||
UPDATE tags
|
||||
SET sort_order = 10,
|
||||
color = '#f97316'
|
||||
WHERE slug = 'note';
|
||||
|
||||
UPDATE tags
|
||||
SET sort_order = 20,
|
||||
color = '#06b6d4'
|
||||
WHERE slug = 'dev';
|
||||
|
||||
CREATE INDEX IF NOT EXISTS tags_sort_order_name_idx
|
||||
ON tags (sort_order ASC, name ASC);
|
||||
Reference in New Issue
Block a user