mattermost-community-enterp.../channels/db/migrations/postgres/000129_add_property_system_architecture.up.sql
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

56 lines
1.5 KiB
PL/PgSQL

CREATE TABLE IF NOT EXISTS PropertyGroups (
ID varchar(26) PRIMARY KEY,
Name varchar(64) NOT NULL,
UNIQUE(Name)
);
DO
$$
BEGIN
IF NOT EXISTS (SELECT * FROM pg_type typ
INNER JOIN pg_namespace nsp ON nsp.oid = typ.typnamespace
WHERE nsp.nspname = current_schema()
AND typ.typname = 'property_field_type') THEN
CREATE TYPE property_field_type AS ENUM (
'text',
'select',
'multiselect',
'date',
'user',
'multiuser'
);
END IF;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS PropertyFields (
ID varchar(26) PRIMARY KEY,
GroupID varchar(26) NOT NULL,
Name varchar(255) NOT NULL,
Type property_field_type,
Attrs jsonb,
TargetID varchar(255),
TargetType varchar(255),
CreateAt bigint NOT NULL,
UpdateAt bigint NOT NULL,
DeleteAt bigint NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_propertyfields_unique ON PropertyFields (GroupID, TargetID, Name) WHERE DeleteAt = 0;
CREATE TABLE IF NOT EXISTS PropertyValues (
ID varchar(26) PRIMARY KEY,
TargetID varchar(255) NOT NULL,
TargetType varchar(255) NOT NULL,
GroupID varchar(26) NOT NULL,
FieldID varchar(26) NOT NULL,
Value jsonb NOT NULL,
CreateAt bigint NOT NULL,
UpdateAt bigint NOT NULL,
DeleteAt bigint NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_propertyvalues_unique ON PropertyValues (GroupID, TargetID, FieldID) WHERE DeleteAt = 0;
CREATE INDEX IF NOT EXISTS idx_propertyvalues_targetid_groupid ON PropertyValues (TargetID, GroupID);