-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherrypicking 22606 to old focalboard
- Loading branch information
1 parent
d7af2be
commit 1ff51ad
Showing
11 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...er/services/store/sqlstore/migrationstests/de_duplicate_category_boards_migration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package migrationstests | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestRunDeDuplicateCategoryBoardsMigration(t *testing.T) { | ||
th, tearDown := SetupTestHelper(t) | ||
defer tearDown() | ||
|
||
if th.IsSQLite() { | ||
t.Skip("SQLite is not supported for this") | ||
} | ||
|
||
th.f.MigrateToStepSkippingLastInterceptor(35). | ||
ExecFile("./fixtures/testDeDuplicateCategoryBoardsMigration.sql") | ||
|
||
th.f.RunInterceptor(35) | ||
|
||
// verifying count of rows | ||
var count int | ||
countQuery := "SELECT COUNT(*) FROM focalboard_category_boards" | ||
row := th.f.DB().QueryRow(countQuery) | ||
err := row.Scan(&count) | ||
assert.NoError(t, err) | ||
assert.Equal(t, 4, count) | ||
} |
6 changes: 4 additions & 2 deletions
6
server/services/store/sqlstore/migrationstests/fixtures/test33_with_deleted_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
INSERT INTO focalboard_category_boards values | ||
INSERT INTO focalboard_category_boards | ||
(id, user_id, category_id, board_id, create_at, update_at, delete_at, sort_order) | ||
values | ||
('id-1', 'user_id-1', 'category-id-1', 'board-id-1', 1672988834402, 1672988834402, 0, 0), | ||
('id-2', 'user_id-1', 'category-id-2', 'board-id-1', 1672988834402, 1672988834402, 0, 0), | ||
('id-3', 'user_id-2', 'category-id-3', 'board-id-2', 1672988834402, 1672988834402, 1672988834402, 0), | ||
('id-4', 'user_id-2', 'category-id-3', 'board-id-4', 1672988834402, 1672988834402, 0, 0), | ||
('id-5', 'user_id-3', 'category-id-4', 'board-id-3', 1672988834402, 1672988834402, 1672988834402, 0); | ||
('id-5', 'user_id-3', 'category-id-4', 'board-id-3', 1672988834402, 1672988834402, 1672988834402, 0); |
6 changes: 4 additions & 2 deletions
6
server/services/store/sqlstore/migrationstests/fixtures/test33_with_no_deleted_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
INSERT INTO focalboard_category_boards values | ||
INSERT INTO focalboard_category_boards | ||
(id, user_id, category_id, board_id, create_at, update_at, delete_at, sort_order) | ||
values | ||
('id-1', 'user_id-1', 'category-id-1', 'board-id-1', 1672988834402, 1672988834402, 0, 0), | ||
('id-2', 'user_id-1', 'category-id-2', 'board-id-1', 1672988834402, 1672988834402, 0, 0), | ||
('id-3', 'user_id-2', 'category-id-3', 'board-id-2', 1672988834402, 1672988834402, 0, 0), | ||
('id-4', 'user_id-2', 'category-id-3', 'board-id-4', 1672988834402, 1672988834402, 0, 0), | ||
('id-5', 'user_id-3', 'category-id-4', 'board-id-3', 1672988834402, 1672988834402, 0, 0); | ||
('id-5', 'user_id-3', 'category-id-4', 'board-id-3', 1672988834402, 1672988834402, 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...r/services/store/sqlstore/migrationstests/fixtures/test37_valid_data_no_hidden_boards.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
INSERT INTO focalboard_category_boards VALUES | ||
INSERT INTO focalboard_category_boards | ||
(id, user_id, category_id, board_id, create_at, update_at, sort_order, hidden) | ||
VALUES | ||
('id-1', 'user-id-1', 'category-id-1', 'board-id-1', 1672889246832, 1672889246832, 0, false), | ||
('id-2', 'user-id-1', 'category-id-2', 'board-id-2', 1672889246832, 1672889246832, 0, false), | ||
('id-3', 'user-id-2', 'category-id-3', 'board-id-3', 1672889246832, 1672889246832, 0, false), | ||
('id-4', 'user-id-2', 'category-id-3', 'board-id-4', 1672889246832, 1672889246832, 0, false), | ||
('id-5', 'user-id-3', 'category-id-4', 'board-id-5', 1672889246832, 1672889246832, 0, false); | ||
('id-5', 'user-id-3', 'category-id-4', 'board-id-5', 1672889246832, 1672889246832, 0, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...rvices/store/sqlstore/migrationstests/fixtures/testDeDuplicateCategoryBoardsMigration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
INSERT INTO focalboard_category_boards(id, user_id, category_id, board_id, create_at, update_at, sort_order) | ||
VALUES | ||
('id_1', 'user_id_1', 'category_id_1', 'board_id_1', 0, 0, 0), | ||
('id_2', 'user_id_1', 'category_id_2', 'board_id_1', 0, 0, 0), | ||
('id_3', 'user_id_1', 'category_id_3', 'board_id_1', 0, 0, 0), | ||
('id_4', 'user_id_2', 'category_id_4', 'board_id_2', 0, 0, 0), | ||
('id_5', 'user_id_2', 'category_id_5', 'board_id_2', 0, 0, 0), | ||
('id_6', 'user_id_3', 'category_id_6', 'board_id_3', 0, 0, 0), | ||
('id_7', 'user_id_4', 'category_id_6', 'board_id_4', 0, 0, 0); |