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

38 lines
1.3 KiB
SQL

CREATE TABLE IF NOT EXISTS publicchannels (
id VARCHAR(26) PRIMARY KEY,
deleteat bigint,
teamid VARCHAR(26),
displayname VARCHAR(64),
name VARCHAR(64),
header VARCHAR(1024),
purpose VARCHAR(250),
UNIQUE (name, teamid)
);
CREATE INDEX IF NOT EXISTS idx_publicchannels_team_id ON publicchannels (teamid);
CREATE INDEX IF NOT EXISTS idx_publicchannels_name ON publicchannels (name);
CREATE INDEX IF NOT EXISTS idx_publicchannels_delete_at ON publicchannels (deleteat);
CREATE INDEX IF NOT EXISTS idx_publicchannels_name_lower ON publicchannels (lower(name));
CREATE INDEX IF NOT EXISTS idx_publicchannels_displayname_lower ON publicchannels (lower(displayname));
CREATE INDEX IF NOT EXISTS idx_publicchannels_search_txt ON publicchannels using gin (to_tsvector('english'::regconfig, (((((name)::text || ' '::text) || (displayname)::text) || ' '::text) || (purpose)::text)));
DO $$
<< migratepc >>
BEGIN
IF(NOT EXISTS (
SELECT
1 FROM publicchannels)) THEN
INSERT INTO publicchannels (id, deleteat, teamid, displayname, name, header, purpose)
SELECT
c.id, c.deleteat, c.teamid, c.displayname, c.name, c.header, c.purpose
FROM
channels c
LEFT JOIN publicchannels pc ON (pc.id = c.id)
WHERE
c.type = 'O' AND pc.id IS NULL;
END IF;
END migratepc
$$;
DROP INDEX IF EXISTS idx_publicchannels_name;