Files
leocrm/templates/plugin-template/migrations/0001_initial.sql
T

18 lines
658 B
SQL
Raw Normal View History

2026-07-23 19:01:18 +02:00
-- 0001_initial.sql
-- Initial migration for the example plugin.
-- Creates the example_items table.
CREATE TABLE IF NOT EXISTS example_items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
name VARCHAR(200) NOT NULL,
description TEXT,
config JSONB DEFAULT '{}',
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_example_items_tenant_id ON example_items(tenant_id);
CREATE INDEX IF NOT EXISTS idx_example_items_name ON example_items(name);