Update schemas to include new indexes (#18313)

* Update schemas to include new indexes

* Increase local usability of gitlab scripts. (#18314)

* Increase local usability of gitlab scripts.

* Fix loading/saving SQL dumps

* Add logging to schema tests.

* Fix adding logs dir.

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

Co-authored-by: Elisabeth Kulzer <elikul@elikul.de>
This commit is contained in:
Claudio Costa
2021-09-01 09:00:49 +02:00
committed by GitHub
parent b6564fec6d
commit 9534f9fb62
9 changed files with 420 additions and 88 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
logs
.DS_Store
node_modules
/data
/dist
/webapp/dist
jobserver

View File

@@ -122,6 +122,9 @@ test-schema-mysql:
script:
- export COMPOSE_PROJECT_NAME="${CI_PIPELINE_IID}schemamysql"
- time cat .gitlab-ci/scripts/test-schema/mysql.sh | /bin/bash
artifacts:
paths:
- build/logs
tags:
- k8s-memory
rules:
@@ -146,6 +149,9 @@ test-schema-postgres:
script:
- export COMPOSE_PROJECT_NAME="${CI_PIPELINE_IID}schemapostgres"
- time cat .gitlab-ci/scripts/test-schema/postgres.sh | /bin/bash
artifacts:
paths:
- build/logs
tags:
- k8s-memory
rules:

View File

@@ -1,40 +1,51 @@
#!/bin/bash
set -xe
echo $DOCKER_HOST
if [[ "$GITLAB_CI" == "" ]]; then
export CI_PROJECT_DIR=$PWD
export CI_REGISTRY=registry.internal.mattermost.com
export COMPOSE_PROJECT_NAME="1schemamysql"
export IMAGE_BUILD_SERVER=$CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20210810_golang-1.16.7
# You need to log in to internal registry to run this script locally
fi
echo "$DOCKER_HOST"
docker ps
DOCKER_NETWORK="${COMPOSE_PROJECT_NAME}"
DOCKER_NETWORK=$COMPOSE_PROJECT_NAME
DOCKER_COMPOSE_FILE="gitlab-dc.schemamysql.yml"
CONTAINER_SERVER="${COMPOSE_PROJECT_NAME}_server_1"
docker network create ${DOCKER_NETWORK}
docker network create $DOCKER_NETWORK
ulimit -n 8096
cd ${CI_PROJECT_DIR}/build
cd "$CI_PROJECT_DIR"/build
docker-compose -f $DOCKER_COMPOSE_FILE run -d --rm start_dependencies
sleep 5
docker run --net ${DOCKER_NETWORK} ${CI_REGISTRY}/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;"
docker run --net $DOCKER_NETWORK "$CI_REGISTRY"/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;"
echo "Creating databases"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T mysql mysql -uroot -pmostest -e "CREATE DATABASE migrated; CREATE DATABASE latest; GRANT ALL PRIVILEGES ON migrated.* TO mmuser; GRANT ALL PRIVILEGES ON latest.* TO mmuser"
docker-compose -f $DOCKER_COMPOSE_FILE exec -T mysql mysql -uroot -pmostest -e "CREATE DATABASE migrated; CREATE DATABASE latest; GRANT ALL PRIVILEGES ON migrated.* TO mmuser; GRANT ALL PRIVILEGES ON latest.* TO mmuser"
echo "Importing mysql dump from version 6.0"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T mysql mysql -D migrated -uroot -pmostest < ${CI_PROJECT_DIR}/scripts/mattermost-mysql-6.0.sql
docker run -d -it --rm --name "${CONTAINER_SERVER}" --net ${DOCKER_NETWORK} \
docker-compose -f $DOCKER_COMPOSE_FILE exec -T mysql mysql -D migrated -uroot -pmostest < "$CI_PROJECT_DIR"/scripts/mattermost-mysql-6.0.sql
docker run -d -it --rm --name "$CONTAINER_SERVER" --net $DOCKER_NETWORK \
--env-file="dotenv/test-schema-validation.env" \
--env MM_SQLSETTINGS_DATASOURCE="mmuser:mostest@tcp(mysql:3306)/migrated?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" \
--env MM_SQLSETTINGS_DRIVERNAME=mysql \
-v $CI_PROJECT_DIR:/mattermost-server \
-v "$CI_PROJECT_DIR":/mattermost-server \
-w /mattermost-server \
$IMAGE_BUILD_SERVER \
bash -c "ulimit -n 8096; make ARGS='version' run-cli && make MM_SQLSETTINGS_DATASOURCE='mmuser:mostest@tcp(mysql:3306)/latest?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' ARGS='version' run-cli"
docker logs -f "${CONTAINER_SERVER}"
mkdir -p logs
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
docker logs -f $CONTAINER_SERVER
tar -czvf logs/docker_logs$COMPOSE_PROJECT_NAME.tar.gz logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
echo "Generating dump"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest migrated > migrated.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest latest > latest.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest migrated > migrated.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest latest > latest.sql
echo "Removing databases created for db comparison"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T mysql mysql -uroot -pmostest -e 'DROP DATABASE migrated; DROP DATABASE latest'
docker-compose -f $DOCKER_COMPOSE_FILE exec -T mysql mysql -uroot -pmostest -e 'DROP DATABASE migrated; DROP DATABASE latest'
echo "Generating diff"
diff migrated.sql latest.sql > diff.txt && echo "Both schemas are same" || (echo "Schema mismatch" && cat diff.txt && exit 1)
docker-compose -f $DOCKER_COMPOSE_FILE down
docker network remove ${DOCKER_NETWORK}
docker network remove $DOCKER_NETWORK

View File

@@ -1,38 +1,50 @@
#!/bin/bash
set -xe
if [[ "$GITLAB_CI" == "" ]]; then
export CI_PROJECT_DIR=$PWD
export CI_REGISTRY=registry.internal.mattermost.com
export COMPOSE_PROJECT_NAME="1schemapostgres"
export IMAGE_BUILD_SERVER=$CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20210810_golang-1.16.7
# You need to log in to internal registry to run this script locally
fi
echo $DOCKER_HOST
docker ps
DOCKER_NETWORK="${COMPOSE_PROJECT_NAME}"
DOCKER_NETWORK=$COMPOSE_PROJECT_NAME
DOCKER_COMPOSE_FILE="gitlab-dc.schemapostgres.yml"
CONTAINER_SERVER="${COMPOSE_PROJECT_NAME}_server_1"
docker network create ${DOCKER_NETWORK}
docker network create $DOCKER_NETWORK
ulimit -n 8096
cd ${CI_PROJECT_DIR}/build
cd "$CI_PROJECT_DIR"/build
docker-compose -f $DOCKER_COMPOSE_FILE run -d --rm start_dependencies
timeout 90s bash -c "until docker exec ${COMPOSE_PROJECT_NAME}_postgres_1 pg_isready ; do sleep 5 ; done"
echo "Creating databases"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T postgres sh -c 'exec echo "CREATE DATABASE migrated; CREATE DATABASE latest;" | exec psql -U mmuser mattermost_test'
docker-compose -f $DOCKER_COMPOSE_FILE exec -T postgres sh -c 'exec echo "CREATE DATABASE migrated; CREATE DATABASE latest;" | exec psql -U mmuser mattermost_test'
echo "Importing postgres dump from version 6.0"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T postgres psql -U mmuser -d migrated < ${CI_PROJECT_DIR}/scripts/mattermost-postgresql-6.0.sql
docker run -d -it --rm --name "${CONTAINER_SERVER}" --net ${DOCKER_NETWORK} \
docker-compose -f $DOCKER_COMPOSE_FILE exec -T postgres psql -U mmuser -d migrated < "$CI_PROJECT_DIR"/scripts/mattermost-postgresql-6.0.sql
docker run -d -it --rm --name $CONTAINER_SERVER --net $DOCKER_NETWORK \
--env-file="dotenv/test-schema-validation.env" \
--env MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mostest@postgres:5432/migrated?sslmode=disable&connect_timeout=10" \
--env MM_SQLSETTINGS_DRIVERNAME=postgres \
-v $CI_PROJECT_DIR:/mattermost-server \
-v "$CI_PROJECT_DIR":/mattermost-server \
-w /mattermost-server \
$IMAGE_BUILD_SERVER \
bash -c "ulimit -n 8096; make ARGS='version' run-cli && make MM_SQLSETTINGS_DATASOURCE='postgres://mmuser:mostest@postgres:5432/latest?sslmode=disable&connect_timeout=10' ARGS='version' run-cli"
docker logs -f "${CONTAINER_SERVER}"
mkdir -p logs
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
docker logs -f $CONTAINER_SERVER
tar -czvf logs/docker_logs$COMPOSE_PROJECT_NAME.tar.gz logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
echo "Generating dump"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T postgres pg_dump --schema-only -d migrated -U mmuser > migrated.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T postgres pg_dump --schema-only -d latest -U mmuser > latest.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -T postgres pg_dump --schema-only -d migrated -U mmuser > migrated.sql
docker-compose -f $DOCKER_COMPOSE_FILE exec -T postgres pg_dump --schema-only -d latest -U mmuser > latest.sql
echo "Removing databases created for db comparison"
docker-compose -f $DOCKER_COMPOSE_FILE exec -d -T postgres sh -c 'exec echo "DROP DATABASE migrated; DROP DATABASE latest;" | exec psql -U mmuser mattermost_test'
docker-compose -f $DOCKER_COMPOSE_FILE exec -T postgres sh -c 'exec echo "DROP DATABASE migrated; DROP DATABASE latest;" | exec psql -U mmuser mattermost_test'
echo "Generating diff"
diff migrated.sql latest.sql > diff.txt && echo "Both schemas are same" || (echo "Schema mismatch" && cat diff.txt && exit 1)
docker-compose -f $DOCKER_COMPOSE_FILE down
docker network remove ${DOCKER_NETWORK}
docker stop
docker network remove $DOCKER_NETWORK

View File

@@ -1,36 +1,44 @@
#!/bin/bash
set -xe
echo $DOCKER_HOST
if [[ "$GITLAB_CI" == "" ]]; then
export CI_PROJECT_DIR=$PWD
export CI_REGISTRY=registry.internal.mattermost.com
export COMPOSE_PROJECT_NAME="1mysql"
export IMAGE_BUILD_SERVER=$CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20210810_golang-1.16.7
# You need to log in to internal registry to run this script locally
fi
echo "$DOCKER_HOST"
docker ps
DOCKER_NETWORK="${COMPOSE_PROJECT_NAME}"
DOCKER_NETWORK=$COMPOSE_PROJECT_NAME
DOCKER_COMPOSE_FILE="gitlab-dc.mysql.yml"
CONTAINER_SERVER="${COMPOSE_PROJECT_NAME}_server_1"
docker network create ${DOCKER_NETWORK}
docker network create $DOCKER_NETWORK
ulimit -n 8096
cd ${CI_PROJECT_DIR}/build
cd "$CI_PROJECT_DIR"/build
docker-compose -f $DOCKER_COMPOSE_FILE run -d --rm start_dependencies
sleep 5
cat ../tests/test-data.ldif | docker-compose exec -d -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest';
docker-compose exec -d -T minio sh -c 'mkdir -p /data/mattermost-test';
docker run -d --name "${COMPOSE_PROJECT_NAME}_curl_mysql" --net ${CI_REGISTRY}/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;"
docker run -d --name "${COMPOSE_PROJECT_NAME}_curl_elasticsearch" --net ${DOCKER_NETWORK} ${CI_REGISTRY}/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
cat ../tests/test-data.ldif | docker-compose exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest';
docker-compose exec -T minio sh -c 'mkdir -p /data/mattermost-test';
docker run --name "${COMPOSE_PROJECT_NAME}_curl_mysql" --net $DOCKER_NETWORK $CI_REGISTRY/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;"
docker run --name "${COMPOSE_PROJECT_NAME}_curl_elasticsearch" --net $DOCKER_NETWORK $CI_REGISTRY/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
docker run -d -it --rm --name "${CONTAINER_SERVER}" --net ${DOCKER_NETWORK} \
docker run -d -it --rm --name $CONTAINER_SERVER --net $DOCKER_NETWORK \
--env-file="dotenv/test.env" \
--env MM_SQLSETTINGS_DATASOURCE="mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true" \
--env MM_SQLSETTINGS_DRIVERNAME=mysql \
-v ${CI_PROJECT_DIR}:/mattermost-server \
-v "$CI_PROJECT_DIR":/mattermost-server \
-w /mattermost-server \
$IMAGE_BUILD_SERVER \
bash -c "ulimit -n 8096; make test-server$RACE_MODE BUILD_NUMBER=$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA TESTFLAGS= TESTFLAGSEE=" \
bash -c scripts/diff-email-templates.sh
mkdir -p logs
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs
docker ps -a --no-trunc > logs/docker_ps
docker stats -a --no-stream > logs/docker_stats
docker logs -f "${CONTAINER_SERVER}"
tar -czvf logs/docker_logs.tar.gz logs/docker-compose_logs logs/docker_ps logs/docker_stats
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
docker ps -a --no-trunc > logs/docker_ps_$COMPOSE_PROJECT_NAME
docker stats -a --no-stream > logs/docker_stats_$COMPOSE_PROJECT_NAME
docker logs -f $CONTAINER_SERVER
tar -czvf logs/docker_logs_$COMPOSE_PROJECT_NAME.tar.gz logs/docker-compose_logs_$COMPOSE_PROJECT_NAME logs/docker_ps_$COMPOSE_PROJECT_NAME logs/docker_stats_$COMPOSE_PROJECT_NAME
docker-compose -f $DOCKER_COMPOSE_FILE down
docker network remove ${DOCKER_NETWORK}
docker network remove $DOCKER_NETWORK

34
.gitlab-ci/scripts/test/postgres.sh Normal file → Executable file
View File

@@ -1,35 +1,43 @@
#!/bin/bash
set -xe
echo $DOCKER_HOST
if [[ "$GITLAB_CI" == "" ]]; then
export CI_PROJECT_DIR=$PWD
export CI_REGISTRY=registry.internal.mattermost.com
export COMPOSE_PROJECT_NAME="1postgres"
export IMAGE_BUILD_SERVER=$CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20210810_golang-1.16.7
# You need to log in to internal registry to run this script locally
fi
echo "$DOCKER_HOST"
docker ps
DOCKER_NETWORK="${COMPOSE_PROJECT_NAME}"
DOCKER_NETWORK=$COMPOSE_PROJECT_NAME
DOCKER_COMPOSE_FILE="gitlab-dc.postgres.yml"
CONTAINER_SERVER="${COMPOSE_PROJECT_NAME}_server_1"
docker network create ${DOCKER_NETWORK}
docker network create $DOCKER_NETWORK
ulimit -n 8096
cd ${CI_PROJECT_DIR}/build
cd "$CI_PROJECT_DIR"/build
docker-compose -f $DOCKER_COMPOSE_FILE run -d --rm start_dependencies
sleep 5
cat ../tests/test-data.ldif | docker-compose exec -d -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest';
docker-compose exec -d -T minio sh -c 'mkdir -p /data/mattermost-test';
timeout 90s bash -c "until docker exec ${COMPOSE_PROJECT_NAME}_postgres_1 pg_isready ; do sleep 5 ; done"
docker run -d --name "${COMPOSE_PROJECT_NAME}_curl_elasticsearch" --net ${DOCKER_NETWORK} ${CI_REGISTRY}/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
docker run -d -it --rm --name "${CONTAINER_SERVER}" --net ${DOCKER_NETWORK} \
docker run --name "${COMPOSE_PROJECT_NAME}_curl_elasticsearch" --net $DOCKER_NETWORK $CI_REGISTRY/mattermost/ci/images/curl:7.59.0-1 sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
docker run -d -it --rm --name "${CONTAINER_SERVER}" --net $DOCKER_NETWORK \
--env-file="dotenv/test.env" \
--env MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10" \
--env MM_SQLSETTINGS_DRIVERNAME=postgres \
-v $CI_PROJECT_DIR:/mattermost-server \
-v "$CI_PROJECT_DIR":/mattermost-server \
-w /mattermost-server \
$IMAGE_BUILD_SERVER \
bash -c "ulimit -n 8096; make test-server$RACE_MODE BUILD_NUMBER=$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA TESTFLAGS= TESTFLAGSEE=" \
bash -c scripts/diff-email-templates.sh
mkdir -p logs
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs
docker ps -a --no-trunc > logs/docker_ps
docker stats -a --no-stream > logs/docker_stats
docker logs -f "${CONTAINER_SERVER}"
tar -czvf logs/docker_logs.tar.gz logs/docker-compose_logs logs/docker_ps logs/docker_stats
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs_$COMPOSE_PROJECT_NAME
docker ps -a --no-trunc > logs/docker_ps_$COMPOSE_PROJECT_NAME
docker stats -a --no-stream > logs/docker_stats_$COMPOSE_PROJECT_NAME
docker logs -f $CONTAINER_SERVER
tar -czvf logs/docker_logs_$COMPOSE_PROJECT_NAME.tar.gz logs/docker-compose_logs_$COMPOSE_PROJECT_NAME logs/docker_ps_$COMPOSE_PROJECT_NAME logs/docker_stats_$COMPOSE_PROJECT_NAME
docker-compose -f $DOCKER_COMPOSE_FILE down
docker network remove ${DOCKER_NETWORK}
docker network remove $DOCKER_NETWORK

View File

@@ -83,7 +83,7 @@ services:
- grafana
start_dependencies:
image: ${CI_REGISTRY}/mattermost/ci/images/mattermost-wait-for-dep:latest
image: ${CI_REGISTRY}/mattermost/ci/images/mattermost-wait-for-dep:latest-1
depends_on:
- mysql
- minio

View File

@@ -1,8 +1,8 @@
-- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64)
-- MariaDB dump 10.19 Distrib 10.5.10-MariaDB, for Linux (x86_64)
--
-- Host: claudiolt-mysql-instance-1.c0gzspkyf2r5.us-east-1.rds.amazonaws.com Database: mattermost
-- Host: 127.0.0.1 Database: mattermost_test
-- ------------------------------------------------------
-- Server version 5.7.12
-- Server version 5.7.12
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
@@ -10,6 +10,10 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Audits`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Audits` (
@@ -24,6 +28,11 @@ CREATE TABLE `Audits` (
KEY `idx_audits_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Bots`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Bots` (
@@ -37,6 +46,11 @@ CREATE TABLE `Bots` (
PRIMARY KEY (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ChannelMemberHistory`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ChannelMemberHistory` (
@@ -47,6 +61,11 @@ CREATE TABLE `ChannelMemberHistory` (
PRIMARY KEY (`ChannelId`,`UserId`,`JoinTime`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ChannelMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ChannelMembers` (
@@ -64,9 +83,15 @@ CREATE TABLE `ChannelMembers` (
`MentionCountRoot` bigint(20) DEFAULT NULL,
`MsgCountRoot` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ChannelId`,`UserId`),
KEY `idx_channelmembers_user_id` (`UserId`)
KEY `idx_channelmembers_user_id_channel_id_last_viewed_at` (`UserId`,`ChannelId`,`LastViewedAt`),
KEY `idx_channelmembers_channel_id_scheme_guest_user_id` (`ChannelId`,`SchemeGuest`,`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Channels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Channels` (
@@ -90,14 +115,20 @@ CREATE TABLE `Channels` (
`TotalMsgCountRoot` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`,`TeamId`),
KEY `idx_channels_team_id` (`TeamId`),
KEY `idx_channels_update_at` (`UpdateAt`),
KEY `idx_channels_create_at` (`CreateAt`),
KEY `idx_channels_delete_at` (`DeleteAt`),
KEY `idx_channels_scheme_id` (`SchemeId`),
KEY `idx_channels_team_id_display_name` (`TeamId`,`DisplayName`),
KEY `idx_channels_team_id_type` (`TeamId`,`Type`),
FULLTEXT KEY `idx_channel_search_txt` (`Name`,`DisplayName`,`Purpose`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ClusterDiscovery`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ClusterDiscovery` (
@@ -112,6 +143,11 @@ CREATE TABLE `ClusterDiscovery` (
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `CommandWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `CommandWebhooks` (
@@ -126,6 +162,11 @@ CREATE TABLE `CommandWebhooks` (
KEY `idx_command_webhook_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Commands`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Commands` (
@@ -154,6 +195,11 @@ CREATE TABLE `Commands` (
KEY `idx_command_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Compliances`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Compliances` (
@@ -171,6 +217,11 @@ CREATE TABLE `Compliances` (
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Emoji`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Emoji` (
@@ -187,6 +238,11 @@ CREATE TABLE `Emoji` (
KEY `idx_emoji_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `FileInfo`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `FileInfo` (
@@ -219,6 +275,11 @@ CREATE TABLE `FileInfo` (
FULLTEXT KEY `idx_fileinfo_content_txt` (`Content`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupChannels` (
@@ -234,6 +295,11 @@ CREATE TABLE `GroupChannels` (
KEY `idx_groupchannels_schemeadmin` (`SchemeAdmin`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupMembers` (
@@ -245,6 +311,11 @@ CREATE TABLE `GroupMembers` (
KEY `idx_groupmembers_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupTeams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupTeams` (
@@ -260,6 +331,11 @@ CREATE TABLE `GroupTeams` (
KEY `idx_groupteams_schemeadmin` (`SchemeAdmin`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `IncomingWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `IncomingWebhooks` (
@@ -283,6 +359,11 @@ CREATE TABLE `IncomingWebhooks` (
KEY `idx_incoming_webhook_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Jobs`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Jobs` (
@@ -299,6 +380,11 @@ CREATE TABLE `Jobs` (
KEY `idx_jobs_type` (`Type`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Licenses`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Licenses` (
@@ -308,6 +394,11 @@ CREATE TABLE `Licenses` (
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `LinkMetadata`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `LinkMetadata` (
@@ -320,6 +411,11 @@ CREATE TABLE `LinkMetadata` (
KEY `idx_link_metadata_url_timestamp` (`URL`(512),`Timestamp`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthAccessData`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthAccessData` (
@@ -336,6 +432,11 @@ CREATE TABLE `OAuthAccessData` (
KEY `idx_oauthaccessdata_refresh_token` (`RefreshToken`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthApps`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthApps` (
@@ -354,6 +455,11 @@ CREATE TABLE `OAuthApps` (
KEY `idx_oauthapps_creator_id` (`CreatorId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthAuthData`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthAuthData` (
@@ -368,6 +474,11 @@ CREATE TABLE `OAuthAuthData` (
PRIMARY KEY (`Code`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OutgoingWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OutgoingWebhooks` (
@@ -394,6 +505,11 @@ CREATE TABLE `OutgoingWebhooks` (
KEY `idx_outgoing_webhook_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PluginKeyValueStore`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PluginKeyValueStore` (
@@ -404,6 +520,11 @@ CREATE TABLE `PluginKeyValueStore` (
PRIMARY KEY (`PluginId`,`PKey`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Posts`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Posts` (
@@ -429,15 +550,20 @@ CREATE TABLE `Posts` (
KEY `idx_posts_update_at` (`UpdateAt`),
KEY `idx_posts_create_at` (`CreateAt`),
KEY `idx_posts_delete_at` (`DeleteAt`),
KEY `idx_posts_root_id` (`RootId`),
KEY `idx_posts_user_id` (`UserId`),
KEY `idx_posts_is_pinned` (`IsPinned`),
KEY `idx_posts_channel_id_update_at` (`ChannelId`,`UpdateAt`),
KEY `idx_posts_channel_id_delete_at_create_at` (`ChannelId`,`DeleteAt`,`CreateAt`),
KEY `idx_posts_root_id_delete_at` (`RootId`,`DeleteAt`),
FULLTEXT KEY `idx_posts_message_txt` (`Message`),
FULLTEXT KEY `idx_posts_hashtags_txt` (`Hashtags`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Preferences`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Preferences` (
@@ -450,6 +576,11 @@ CREATE TABLE `Preferences` (
KEY `idx_preferences_name` (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ProductNoticeViewState`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ProductNoticeViewState` (
@@ -462,6 +593,11 @@ CREATE TABLE `ProductNoticeViewState` (
KEY `idx_notice_views_notice_id` (`NoticeId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PublicChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PublicChannels` (
@@ -479,6 +615,11 @@ CREATE TABLE `PublicChannels` (
FULLTEXT KEY `idx_publicchannels_search_txt` (`Name`,`DisplayName`,`Purpose`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Reactions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Reactions` (
@@ -492,6 +633,11 @@ CREATE TABLE `Reactions` (
PRIMARY KEY (`PostId`,`UserId`,`EmojiName`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RemoteClusters`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RemoteClusters` (
@@ -510,6 +656,11 @@ CREATE TABLE `RemoteClusters` (
UNIQUE KEY `remote_clusters_site_url_unique` (`RemoteTeamId`,`SiteURL`(168))
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPolicies`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPolicies` (
@@ -520,6 +671,11 @@ CREATE TABLE `RetentionPolicies` (
KEY `IDX_RetentionPolicies_DisplayName` (`DisplayName`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPoliciesChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesChannels` (
@@ -530,6 +686,11 @@ CREATE TABLE `RetentionPoliciesChannels` (
CONSTRAINT `FK_RetentionPoliciesChannels_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPoliciesTeams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesTeams` (
@@ -540,6 +701,11 @@ CREATE TABLE `RetentionPoliciesTeams` (
CONSTRAINT `FK_RetentionPoliciesTeams_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Roles`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Roles` (
@@ -557,6 +723,11 @@ CREATE TABLE `Roles` (
UNIQUE KEY `Name` (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Schemes`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Schemes` (
@@ -581,6 +752,11 @@ CREATE TABLE `Schemes` (
KEY `idx_schemes_channel_admin_role` (`DefaultChannelAdminRole`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Sessions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Sessions` (
@@ -603,6 +779,11 @@ CREATE TABLE `Sessions` (
KEY `idx_sessions_last_activity_at` (`LastActivityAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelAttachments`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelAttachments` (
@@ -615,6 +796,11 @@ CREATE TABLE `SharedChannelAttachments` (
UNIQUE KEY `FileId` (`FileId`,`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelRemotes`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelRemotes` (
@@ -632,6 +818,11 @@ CREATE TABLE `SharedChannelRemotes` (
UNIQUE KEY `ChannelId` (`ChannelId`,`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelUsers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelUsers` (
@@ -646,6 +837,11 @@ CREATE TABLE `SharedChannelUsers` (
KEY `idx_sharedchannelusers_remote_id` (`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannels` (
@@ -665,6 +861,11 @@ CREATE TABLE `SharedChannels` (
UNIQUE KEY `ShareName` (`ShareName`,`TeamId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SidebarCategories`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SidebarCategories` (
@@ -680,6 +881,11 @@ CREATE TABLE `SidebarCategories` (
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SidebarChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SidebarChannels` (
@@ -690,6 +896,11 @@ CREATE TABLE `SidebarChannels` (
PRIMARY KEY (`ChannelId`,`UserId`,`CategoryId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Status` (
@@ -700,9 +911,14 @@ CREATE TABLE `Status` (
`DNDEndTime` bigint(20) DEFAULT NULL,
`PrevStatus` varchar(32) DEFAULT NULL,
PRIMARY KEY (`UserId`),
KEY `idx_status_status` (`Status`)
KEY `idx_status_status_dndendtime` (`Status`,`DNDEndTime`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Systems`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Systems` (
@@ -711,6 +927,11 @@ CREATE TABLE `Systems` (
PRIMARY KEY (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `TeamMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `TeamMembers` (
@@ -726,6 +947,11 @@ CREATE TABLE `TeamMembers` (
KEY `idx_teammembers_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Teams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Teams` (
@@ -754,6 +980,11 @@ CREATE TABLE `Teams` (
KEY `idx_teams_scheme_id` (`SchemeId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `TermsOfService`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `TermsOfService` (
@@ -764,6 +995,11 @@ CREATE TABLE `TermsOfService` (
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ThreadMemberships`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ThreadMemberships` (
@@ -779,6 +1015,11 @@ CREATE TABLE `ThreadMemberships` (
KEY `idx_thread_memberships_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Threads`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Threads` (
@@ -788,9 +1029,14 @@ CREATE TABLE `Threads` (
`LastReplyAt` bigint(20) DEFAULT NULL,
`Participants` json DEFAULT NULL,
PRIMARY KEY (`PostId`),
KEY `idx_threads_channel_id` (`ChannelId`)
KEY `idx_threads_channel_id_last_reply_at` (`ChannelId`,`LastReplyAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Tokens`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Tokens` (
@@ -801,6 +1047,11 @@ CREATE TABLE `Tokens` (
PRIMARY KEY (`Token`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UploadSessions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UploadSessions` (
@@ -820,6 +1071,11 @@ CREATE TABLE `UploadSessions` (
KEY `idx_uploadsessions_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserAccessTokens`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserAccessTokens` (
@@ -833,6 +1089,11 @@ CREATE TABLE `UserAccessTokens` (
KEY `idx_user_access_tokens_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserGroups`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserGroups` (
@@ -853,6 +1114,11 @@ CREATE TABLE `UserGroups` (
KEY `idx_usergroups_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserTermsOfService`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserTermsOfService` (
@@ -862,6 +1128,11 @@ CREATE TABLE `UserTermsOfService` (
PRIMARY KEY (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Users`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Users` (
@@ -904,6 +1175,11 @@ CREATE TABLE `Users` (
FULLTEXT KEY `idx_users_names_no_full_name_txt` (`Username`,`Nickname`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `schema_migrations`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schema_migrations` (
@@ -912,3 +1188,11 @@ CREATE TABLE `schema_migrations` (
PRIMARY KEY (`version`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-08-31 11:45:07

View File

@@ -2,8 +2,8 @@
-- PostgreSQL database dump
--
-- Dumped from database version 11.7
-- Dumped by pg_dump version 11.10 (Ubuntu 11.10-1.pgdg18.04+1)
-- Dumped from database version 10.18 (Debian 10.18-1.pgdg90+1)
-- Dumped by pg_dump version 13.2
SET statement_timeout = 0;
SET lock_timeout = 0;
@@ -18,8 +18,6 @@ SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: audits; Type: TABLE; Schema: public; Owner: mmuser
--
@@ -1618,10 +1616,17 @@ CREATE INDEX idx_channel_search_txt ON public.channels USING gin (to_tsvector('e
--
-- Name: idx_channelmembers_user_id; Type: INDEX; Schema: public; Owner: mmuser
-- Name: idx_channelmembers_channel_id_scheme_guest_user_id; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_channelmembers_user_id ON public.channelmembers USING btree (userid);
CREATE INDEX idx_channelmembers_channel_id_scheme_guest_user_id ON public.channelmembers USING btree (channelid, schemeguest, userid);
--
-- Name: idx_channelmembers_user_id_channel_id_last_viewed_at; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_channelmembers_user_id_channel_id_last_viewed_at ON public.channelmembers USING btree (userid, channelid, lastviewedat);
--
@@ -1660,10 +1665,17 @@ CREATE INDEX idx_channels_scheme_id ON public.channels USING btree (schemeid);
--
-- Name: idx_channels_team_id; Type: INDEX; Schema: public; Owner: mmuser
-- Name: idx_channels_team_id_display_name; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_channels_team_id ON public.channels USING btree (teamid);
CREATE INDEX idx_channels_team_id_display_name ON public.channels USING btree (teamid, displayname);
--
-- Name: idx_channels_team_id_type; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_channels_team_id_type ON public.channels USING btree (teamid, type);
--
@@ -1982,10 +1994,10 @@ CREATE INDEX idx_posts_message_txt ON public.posts USING gin (to_tsvector('engli
--
-- Name: idx_posts_root_id; Type: INDEX; Schema: public; Owner: mmuser
-- Name: idx_posts_root_id_delete_at; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_posts_root_id ON public.posts USING btree (rootid);
CREATE INDEX idx_posts_root_id_delete_at ON public.posts USING btree (rootid, deleteat);
--
@@ -2136,10 +2148,10 @@ CREATE INDEX idx_sharedchannelusers_remote_id ON public.sharedchannelusers USING
--
-- Name: idx_status_status; Type: INDEX; Schema: public; Owner: mmuser
-- Name: idx_status_status_dndendtime; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_status_status ON public.status USING btree (status);
CREATE INDEX idx_status_status_dndendtime ON public.status USING btree (status, dndendtime);
--
@@ -2213,10 +2225,10 @@ CREATE INDEX idx_thread_memberships_user_id ON public.threadmemberships USING bt
--
-- Name: idx_threads_channel_id; Type: INDEX; Schema: public; Owner: mmuser
-- Name: idx_threads_channel_id_last_reply_at; Type: INDEX; Schema: public; Owner: mmuser
--
CREATE INDEX idx_threads_channel_id ON public.threads USING btree (channelid);
CREATE INDEX idx_threads_channel_id_last_reply_at ON public.threads USING btree (channelid, lastreplyat);
--
@@ -2361,16 +2373,6 @@ ALTER TABLE ONLY public.retentionpoliciesteams
ADD CONSTRAINT fk_retentionpoliciesteams_retentionpolicies FOREIGN KEY (policyid) REFERENCES public.retentionpolicies(id) ON DELETE CASCADE;
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: mmuser
--
REVOKE ALL ON SCHEMA public FROM rdsadmin;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO mmuser;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--