mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 07:10:19 +00:00
NOISSUE - Add migrations for UI metadata (#3366)
Continuous Delivery / lint-and-build (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
CI Pipeline / Check Certs (push) Has been cancelled
CI Pipeline / Lint Proto (push) Has been cancelled
CI Pipeline / Detect Changes (push) Has been cancelled
Continuous Delivery / Build and Push Docker Images (push) Has been cancelled
CI Pipeline / lint-and-build (push) Has been cancelled
CI Pipeline / Test ${{ matrix.module }} (push) Has been cancelled
CI Pipeline / Upload Coverage (push) Has been cancelled
Continuous Delivery / lint-and-build (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
CI Pipeline / Check Certs (push) Has been cancelled
CI Pipeline / Lint Proto (push) Has been cancelled
CI Pipeline / Detect Changes (push) Has been cancelled
Continuous Delivery / Build and Push Docker Images (push) Has been cancelled
CI Pipeline / lint-and-build (push) Has been cancelled
CI Pipeline / Test ${{ matrix.module }} (push) Has been cancelled
CI Pipeline / Upload Coverage (push) Has been cancelled
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
This commit is contained in:
@@ -84,6 +84,17 @@ func Migration() (*migrate.MemoryMigrationSource, error) {
|
||||
`ALTER TABLE channels ALTER COLUMN updated_at TYPE TIMESTAMP;`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "channels_05",
|
||||
Up: []string{
|
||||
`UPDATE channels
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
channelsMigration.Migrations = append(channelsMigration.Migrations, rolesMigration.Migrations...)
|
||||
|
||||
@@ -85,6 +85,20 @@ func Migration() (*migrate.MemoryMigrationSource, error) {
|
||||
`ALTER TABLE clients DROP COLUMN private_metadata;`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "clients_05",
|
||||
Up: []string{
|
||||
`UPDATE clients
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`,
|
||||
`UPDATE clients
|
||||
SET private_metadata = (COALESCE(private_metadata, '{}'::jsonb) || COALESCE(private_metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE private_metadata ? 'ui' AND jsonb_typeof(private_metadata->'ui') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,17 @@ func Migration() (*migrate.MemoryMigrationSource, error) {
|
||||
END $$;`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "domain_7",
|
||||
Up: []string{
|
||||
`UPDATE domains
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,17 @@ func Migration() (*migrate.MemoryMigrationSource, error) {
|
||||
`ALTER TABLE groups ALTER COLUMN updated_at TYPE TIMESTAMP;`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "groups_06",
|
||||
Up: []string{
|
||||
`UPDATE groups
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,34 @@ func Migration() *migrate.MemoryMigrationSource {
|
||||
`ALTER TABLE users DROP COLUMN private_metadata;`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "clients_11",
|
||||
Up: []string{
|
||||
`UPDATE users
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`,
|
||||
`UPDATE users
|
||||
SET private_metadata = (COALESCE(private_metadata, '{}'::jsonb) || COALESCE(private_metadata->'ui', '{}'::jsonb)) - 'ui'
|
||||
WHERE private_metadata ? 'ui' AND jsonb_typeof(private_metadata->'ui') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "clients_12",
|
||||
Up: []string{
|
||||
`UPDATE users
|
||||
SET metadata = (COALESCE(metadata, '{}'::jsonb) || COALESCE(metadata->'admin', '{}'::jsonb)) - 'admin'
|
||||
WHERE metadata ? 'admin' AND jsonb_typeof(metadata->'admin') = 'object'`,
|
||||
`UPDATE users
|
||||
SET private_metadata = (COALESCE(private_metadata, '{}'::jsonb) || COALESCE(private_metadata->'admin', '{}'::jsonb)) - 'admin'
|
||||
WHERE private_metadata ? 'admin' AND jsonb_typeof(private_metadata->'admin') = 'object'`,
|
||||
},
|
||||
Down: []string{
|
||||
`SELECT 1`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user