starter-kit/migrations/000001_create_roles_table.up.sql
ulflow_phattt2901 e8aeef6013
Some checks failed
CI Pipeline / Security Scan (push) Successful in 2m53s
CI Pipeline / Lint (push) Failing after 2m43s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test (push) Has been skipped
CI Pipeline / Notification (push) Successful in 2s
feat: add database migrations and enhance Makefile with environment loading
2025-06-04 07:32:51 +07:00

26 lines
685 B
SQL

-- +goose Up
-- +goose StatementBegin
-- Enable UUID extension
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE roles (
id SERIAL PRIMARY KEY,
name VARCHAR(50) UNIQUE NOT NULL,
description TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- Insert default roles
INSERT INTO roles (name, description) VALUES
('admin', 'Quản trị viên hệ thống'),
('manager', 'Quản lý'),
('user', 'Người dùng thông thường'),
('guest', 'Khách');
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS roles CASCADE;
-- +goose StatementEnd