db/migrations: ensure to drop parentid from posts table (#21493)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b62ee905ae
Коммит
c5f4882f0a
@@ -188,6 +188,8 @@ db/migrations/mysql/000093_notify_admin.down.sql
|
|||||||
db/migrations/mysql/000093_notify_admin.up.sql
|
db/migrations/mysql/000093_notify_admin.up.sql
|
||||||
db/migrations/mysql/000094_threads_teamid.down.sql
|
db/migrations/mysql/000094_threads_teamid.down.sql
|
||||||
db/migrations/mysql/000094_threads_teamid.up.sql
|
db/migrations/mysql/000094_threads_teamid.up.sql
|
||||||
|
db/migrations/mysql/000095_remove_posts_parentid.down.sql
|
||||||
|
db/migrations/mysql/000095_remove_posts_parentid.up.sql
|
||||||
db/migrations/postgres/000001_create_teams.down.sql
|
db/migrations/postgres/000001_create_teams.down.sql
|
||||||
db/migrations/postgres/000001_create_teams.up.sql
|
db/migrations/postgres/000001_create_teams.up.sql
|
||||||
db/migrations/postgres/000002_create_team_members.down.sql
|
db/migrations/postgres/000002_create_team_members.down.sql
|
||||||
@@ -376,3 +378,5 @@ db/migrations/postgres/000093_notify_admin.down.sql
|
|||||||
db/migrations/postgres/000093_notify_admin.up.sql
|
db/migrations/postgres/000093_notify_admin.up.sql
|
||||||
db/migrations/postgres/000094_threads_teamid.down.sql
|
db/migrations/postgres/000094_threads_teamid.down.sql
|
||||||
db/migrations/postgres/000094_threads_teamid.up.sql
|
db/migrations/postgres/000094_threads_teamid.up.sql
|
||||||
|
db/migrations/postgres/000095_remove_posts_parentid.down.sql
|
||||||
|
db/migrations/postgres/000095_remove_posts_parentid.up.sql
|
||||||
|
|||||||
1
db/migrations/mysql/000095_remove_posts_parentid.down.sql
Обычный файл
1
db/migrations/mysql/000095_remove_posts_parentid.down.sql
Обычный файл
@@ -0,0 +1 @@
|
|||||||
|
-- Intentionally left blank as forward migration is not reversible.
|
||||||
17
db/migrations/mysql/000095_remove_posts_parentid.up.sql
Обычный файл
17
db/migrations/mysql/000095_remove_posts_parentid.up.sql
Обычный файл
@@ -0,0 +1,17 @@
|
|||||||
|
-- While upgrading from 5.x to 6.x with manual queries, there is a chance that this
|
||||||
|
-- migration is skipped. In that case, we need to make sure that the column is dropped.
|
||||||
|
|
||||||
|
SET @preparedStatement = (SELECT IF(
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE table_name = 'Posts'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
AND column_name = 'ParentId'
|
||||||
|
) > 0,
|
||||||
|
'ALTER TABLE Posts DROP COLUMN ParentId;',
|
||||||
|
'SELECT 1'
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE alterIfExists FROM @preparedStatement;
|
||||||
|
EXECUTE alterIfExists;
|
||||||
|
DEALLOCATE PREPARE alterIfExists;
|
||||||
1
db/migrations/postgres/000095_remove_posts_parentid.down.sql
Обычный файл
1
db/migrations/postgres/000095_remove_posts_parentid.down.sql
Обычный файл
@@ -0,0 +1 @@
|
|||||||
|
-- Intentionally left blank as forward migration is not reversible.
|
||||||
4
db/migrations/postgres/000095_remove_posts_parentid.up.sql
Обычный файл
4
db/migrations/postgres/000095_remove_posts_parentid.up.sql
Обычный файл
@@ -0,0 +1,4 @@
|
|||||||
|
-- While upgrading from 5.x to 6.x with manual queries, there is a chance that this
|
||||||
|
-- migration is skipped. In that case, we need to make sure that the column is dropped.
|
||||||
|
|
||||||
|
ALTER TABLE posts DROP COLUMN IF EXISTS parentid;
|
||||||
Ссылка в новой задаче
Block a user