Channel banner sql migrations (#30274)
* Adde MySQL and Postgres migrations * Replaced select * with column names * removed all * from channel SQL store * cleanup * Fixed a duplicate column * cleanup * Added migrations and store support * WIP * used channelname slice in a missed place * Handled patch * Added app level tests * Added API layer tests * Added API layer tests * WIP * converted to query builder * cleanupo * added not null and default constraints * Fixed test * fixed file name * review fixes * review fixes * updated migration file * fixed text * Review fixes
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6df8726321
Коммит
6e738f489f
@@ -261,6 +261,8 @@ channels/db/migrations/mysql/000131_create_index_pagination_on_property_values.d
|
||||
channels/db/migrations/mysql/000131_create_index_pagination_on_property_values.up.sql
|
||||
channels/db/migrations/mysql/000132_create_index_pagination_on_property_fields.down.sql
|
||||
channels/db/migrations/mysql/000132_create_index_pagination_on_property_fields.up.sql
|
||||
channels/db/migrations/mysql/000133_add_channel_banner_fields.down.sql
|
||||
channels/db/migrations/mysql/000133_add_channel_banner_fields.up.sql
|
||||
channels/db/migrations/postgres/000001_create_teams.down.sql
|
||||
channels/db/migrations/postgres/000001_create_teams.up.sql
|
||||
channels/db/migrations/postgres/000002_create_team_members.down.sql
|
||||
@@ -523,3 +525,5 @@ channels/db/migrations/postgres/000131_create_index_pagination_on_property_value
|
||||
channels/db/migrations/postgres/000131_create_index_pagination_on_property_values.up.sql
|
||||
channels/db/migrations/postgres/000132_create_index_pagination_on_property_fields.down.sql
|
||||
channels/db/migrations/postgres/000132_create_index_pagination_on_property_fields.up.sql
|
||||
channels/db/migrations/postgres/000133_add_channel_banner_fields.down.sql
|
||||
channels/db/migrations/postgres/000133_add_channel_banner_fields.up.sql
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
SET @preparedStatement = (SELECT IF(
|
||||
EXISTS(
|
||||
SELECT 1 FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE table_name = 'Channels'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'BannerInfo'
|
||||
),
|
||||
'ALTER TABLE Channels DROP COLUMN BannerInfo;',
|
||||
'SELECT 1;'
|
||||
));
|
||||
|
||||
PREPARE removeColumnIfExists FROM @preparedStatement;
|
||||
EXECUTE removeColumnIfExists;
|
||||
DEALLOCATE PREPARE removeColumnIfExists;
|
||||
@@ -0,0 +1,14 @@
|
||||
SET @preparedStatement = (SELECT IF(
|
||||
NOT EXISTS(
|
||||
SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Channels'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'BannerInfo'
|
||||
),
|
||||
'ALTER TABLE Channels ADD COLUMN BannerInfo json;',
|
||||
'SELECT 1;'
|
||||
));
|
||||
|
||||
PREPARE addColumnIfNotExists FROM @preparedStatement;
|
||||
EXECUTE addColumnIfNotExists;
|
||||
DEALLOCATE PREPARE addColumnIfNotExists;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE channels DROP COLUMN IF EXISTS bannerinfo;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE channels ADD COLUMN IF NOT EXISTS bannerinfo jsonb;
|
||||
Ссылка в новой задаче
Block a user