mattermost-community-enterp.../channels/db/migrations/postgres/000053_create_retention_policies.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

45 lines
1.4 KiB
SQL

CREATE TABLE IF NOT EXISTS retentionpolicies (
id VARCHAR(26),
displayname VARCHAR(64),
postduration bigint,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS retentionpoliciesteams (
PolicyId varchar(26),
teamid varchar(26),
PRIMARY KEY (teamid)
);
CREATE TABLE IF NOT EXISTS retentionpolicieschannels (
policyid varchar(26),
channelid varchar(26),
PRIMARY KEY (channelid)
);
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'fk_retentionpoliciesteams_retentionpolicies') THEN
ALTER TABLE retentionpoliciesteams
ADD CONSTRAINT fk_retentionpoliciesteams_retentionpolicies
FOREIGN KEY (policyid) REFERENCES retentionpolicies (id) ON DELETE CASCADE;
END IF;
END;
$$;
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'fk_retentionpolicieschannels_retentionpolicies') THEN
ALTER TABLE retentionpolicieschannels
ADD CONSTRAINT fk_retentionpolicieschannels_retentionpolicies
FOREIGN KEY (policyid) REFERENCES retentionpolicies (id) ON DELETE CASCADE;
END IF;
END;
$$;
CREATE INDEX IF NOT EXISTS IDX_RetentionPoliciesTeams_PolicyId ON retentionpoliciesteams (policyid);
CREATE INDEX IF NOT EXISTS IDX_RetentionPoliciesChannels_PolicyId ON retentionpolicieschannels (policyid);
DROP INDEX IF EXISTS IDX_RetentionPolicies_DisplayName_Id;
CREATE INDEX IF NOT EXISTS IDX_RetentionPolicies_DisplayName ON retentionpolicies (displayname);