mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
03f4717e96
* WIP * Added migrations * Updating store method * WIP * WIP * Updated DND * WIP * WIP * WIP * WIP * WIP * wip * WIP * Adding new DB tool * Used migration functions in new migrations * Unique constraint migration * Unique constraint migration * Added SQLITE migrations * Added SQLITE support in few more migrations * Added SQLITE support in few more migrations * WIP * Used old-fashioned way to add unique constraint * Using oldsqlite method * Using oldsqlite method * Fixed all store and app layer tests * fixed integration tests * test and lint fix * Updated migration for MySQL and Postgres on personal server * Types fix * sqlite fix * fix typo * misc cleanup * added new tests * added new tests * de-duping input for postgres * integration tests, rmeoved uneeded migration * Added some migration tests * Added some migration tests * Fixed a test * completed migration tests * completed migration tests * Removed leftover debug statements Co-authored-by: Mattermost Build <build@mattermost.com>
64 lines
1.5 KiB
Go
64 lines
1.5 KiB
Go
package migrationstests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test38RemoveHiddenBoardIDsFromPreferences(t *testing.T) {
|
|
t.Run("standalone - no data exist", func(t *testing.T) {
|
|
th, tearDown := SetupTestHelper(t)
|
|
defer tearDown()
|
|
th.f.MigrateToStep(38)
|
|
})
|
|
|
|
t.Run("plugin - no data exist", func(t *testing.T) {
|
|
th, tearDown := SetupTestHelper(t)
|
|
defer tearDown()
|
|
th.f.MigrateToStep(38)
|
|
})
|
|
|
|
t.Run("standalone - some data exist", func(t *testing.T) {
|
|
th, tearDown := SetupTestHelper(t)
|
|
defer tearDown()
|
|
th.f.MigrateToStep(37).
|
|
ExecFile("./fixtures/test38_add_standalone_preferences.sql")
|
|
|
|
// verify existing data count
|
|
var count int
|
|
countQuery := "SELECT COUNT(*) FROM focalboard_preferences"
|
|
err := th.f.DB().Get(&count, countQuery)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 4, count)
|
|
|
|
th.f.MigrateToStep(38)
|
|
|
|
// now the count should be 0
|
|
err = th.f.DB().Get(&count, countQuery)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 2, count)
|
|
})
|
|
|
|
t.Run("plugin - some data exist", func(t *testing.T) {
|
|
th, tearDown := SetupPluginTestHelper(t)
|
|
defer tearDown()
|
|
th.f.MigrateToStep(37).
|
|
ExecFile("./fixtures/test38_add_plugin_preferences.sql")
|
|
|
|
// verify existing data count
|
|
var count int
|
|
countQuery := "SELECT COUNT(*) FROM Preferences"
|
|
err := th.f.DB().Get(&count, countQuery)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 4, count)
|
|
|
|
th.f.MigrateToStep(38)
|
|
|
|
// now the count should be 0
|
|
err = th.f.DB().Get(&count, countQuery)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 2, count)
|
|
})
|
|
}
|