mengstack-api/migrations/000006_add_examples.up.sql
MengStack Dev df809f1045
Some checks failed
CI / Build & Test (push) Failing after 1m31s
feat: user CRUD API + dashboard stats + kernel infrastructure
- Add user management endpoints (list/create/get/update/delete) with pagination and search
- Add dashboard stats endpoint with tenant/user/online counts and growth metrics
- Add tenant resolver middleware for multi-tenant request scoping
- Add i18n kernel with zh/en message files and AcceptLanguage middleware
- Add WebSocket hub/handler for real-time communication
- Add job scheduler kernel with cron support
- Add plugin sandbox for isolated execution
- Add storage kernel (local filesystem)
- Add event bus kernel for pub/sub
- Add cache kernel abstraction
- Add database migration runner and version upgrade checker
- Add rate limiting middleware with Redis backend
- Add SQL migrations for rbac, audit_logs, settings, notifications, examples
- Extend user repository with list/delete/count operations
- Register all module routes with tenant resolver
2026-10-03 03:42:58 +08:00

17 lines
605 B
SQL

CREATE TABLE IF NOT EXISTS examples (
id BIGSERIAL,
tenant_id UUID NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT,
status SMALLINT NOT NULL DEFAULT 1,
expires_at TIMESTAMPTZ NOT NULL DEFAULT '0001-01-01T00:00:00Z',
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMPTZ,
creator_id BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (id, tenant_id)
);
CREATE INDEX IF NOT EXISTS idx_examples_tenant_id ON examples(tenant_id);
CREATE INDEX IF NOT EXISTS idx_examples_deleted_at ON examples(deleted_at);