From 072ec1fb782e3a6fcda388d956680c3a0ec855d6 Mon Sep 17 00:00:00 2001 From: paulfantom Date: Tue, 12 Oct 2021 19:16:44 +0200 Subject: [PATCH] Fix 0.5.1 to 0.6.x SQL migration script Signed-off-by: paulfantom --- pkg/migrations/migration_files_generated.go | 4 ++-- pkg/migrations/sql/versions/dev/0.5.2-dev/1-downsampling.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/migrations/migration_files_generated.go b/pkg/migrations/migration_files_generated.go index e23458e4c2..cbe4fb6e14 100644 --- a/pkg/migrations/migration_files_generated.go +++ b/pkg/migrations/migration_files_generated.go @@ -294,9 +294,9 @@ var MigrationFiles = func() http.FileSystem { "/versions/dev/0.5.2-dev/1-downsampling.sql": &vfsgen۰CompressedFileInfo{ name: "1-downsampling.sql", modTime: time.Time{}, - uncompressedSize: 1755, + uncompressedSize: 1767, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\x9c\x93\x4f\x6f\xe2\x3a\x14\xc5\xf7\xfe\x14\x47\x7d\x48\x05\x09\xd0\xdb\xf4\xbd\x05\x9a\x45\x48\xdc\x36\x52\x70\x18\x70\x34\xd5\x8c\x46\x51\x86\x5c\x8a\xd5\x90\x20\xdb\xe9\x9f\x6f\x3f\x4a\x02\x33\x10\x4a\x69\xbb\x22\xb2\xaf\x7f\xe7\x72\xcf\xb9\x5e\x88\x4e\x87\x8d\xf9\x8d\x2f\x18\x30\x18\xc8\x95\x32\x58\xaa\x67\x32\xd8\x68\x7a\x54\x45\x69\x50\x6e\xd2\xc4\x92\x81\x2d\xf0\xef\xf0\x3f\xd8\x55\x62\xf1\x44\x9a\x50\xe4\xd9\x0b\x36\x89\xb6\x2a\xc9\xb2\x17\x24\x9b\x4d\xa6\x28\x1d\x62\x4e\x04\x65\x4c\x49\xf8\xe7\xff\xab\xab\x9a\x1b\x2e\x2d\xe5\xb0\x15\x5d\x99\xfc\xd2\x22\x27\x4a\x29\x45\x92\xa7\x30\x05\x9e\x54\x96\x81\xb4\x2e\x34\x8a\xd2\x32\xc0\x09\x24\x9f\x41\x3a\xe3\x80\x63\xee\xde\xf2\x89\x13\xbb\x8e\x74\x82\xf0\x66\xb8\x26\xab\xd5\x82\x01\xde\x2c\x9c\xc2\x0d\x83\x68\x22\x60\x93\x5f\x19\xc5\x66\xb1\xa2\x75\xd2\x6f\xdd\x19\xd2\x8a\x4c\x5c\x97\xb4\xef\x94\x89\x1f\x15\x3d\x55\xc7\x8e\xe7\xc1\x0d\xc5\x5c\xce\x1c\x5f\x48\xe0\xa2\x11\x8a\xb7\x3f\x79\xb2\xa6\x86\xd1\x7c\x3e\xd0\xcb\x05\x22\xe1\x7f\x8d\x78\x77\xaf\xa4\x07\x5f\xb8\x41\xe4\x71\x74\xff\x16\xf7\xde\xe2\x9f\x60\xee\xbd\x1e\x31\x7e\xe7\xf2\xa9\xf4\x43\x81\x6f\xb7\x5c\xa0\xb0\x2b\xd2\x06\xb2\xfa\x1e\x0c\xd4\x7d\x5e\x68\x62\x00\x20\xa2\x20\x18\x31\x2e\x3c\xd6\xe9\x8c\x18\x7b\xcf\x14\x77\x8d\x1d\x8d\x11\x95\x36\x44\x28\x6b\x2a\x3c\x7e\xed\x44\x81\xc4\xe5\x16\xe4\x39\xd2\xb9\xec\xb7\x01\xfb\xb3\xae\x01\x7d\x0c\x06\x87\xa7\xc6\x16\xba\x4a\xd3\xaa\x29\x40\xb1\xac\xbf\x9b\xcb\xd2\x50\x5a\x05\xad\x2e\xaa\xcf\x9b\xb7\x48\x13\x9b\x60\x59\xe8\x26\x43\x4d\xf7\xc3\xb6\xfa\xd6\x4d\x8c\xc3\x30\xe0\x8e\x38\x6e\x7e\x99\x64\x86\x9a\xa6\xb7\x29\xf8\xe3\xc7\x59\xb7\xdf\x7c\xf6\x5a\x69\xcb\xf0\x93\x02\xcd\xb8\x5b\x88\x6d\x0c\xb0\x9f\xad\xfe\x81\x3f\xa7\x93\x76\x4a\xfa\xbc\x5c\xf7\x60\x8f\x70\x90\x41\x16\x4d\x3d\x47\x9e\x08\x12\xe6\x5c\x1e\xda\xfc\x65\xef\xf5\xe8\x7c\x12\xb7\x1b\xff\x5a\x8c\x2a\xf4\xce\xc9\x11\x63\xb5\x03\xd7\x91\x70\xeb\x7d\xf0\xaf\xc1\xef\xfc\xb9\x9c\xb7\xb1\xf7\x64\xe3\x63\x73\xd4\x32\xa6\x67\x65\xac\xe9\x4a\x7e\x27\x7b\xa3\x8f\xd0\x16\x45\xbe\x54\x7a\x4d\x69\x5c\xe6\x55\x4e\xe3\xa6\xcb\x2e\x2a\x54\x1f\x63\xff\xc6\x17\xf2\xc7\xcf\x3e\xa4\x3f\xe1\x73\xe9\x4c\xa6\xf2\xfb\xfb\x15\xd6\x89\x7e\x68\x81\x1b\xee\x1e\xed\x93\xe8\x94\x32\xb2\x14\xd3\xf3\x46\xe9\x37\xe9\xcd\x5f\xf8\xac\x8a\x2e\x36\xbb\x89\x2f\x56\x65\xfe\x10\x57\x3b\x7b\x2c\xb3\x23\x4e\x67\xa1\xcb\xbd\x68\xc6\x3f\x80\x3c\x37\x93\xfe\x6e\xf5\x7b\x23\xf6\x3b\x00\x00\xff\xff\x3e\x89\xf8\xb3\xdb\x06\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\x9c\x94\xdf\x6f\xda\x3e\x14\xc5\xdf\xfd\x57\x1c\xf5\x8b\x54\x90\x00\x7d\xfb\xd0\xed\x01\xf5\x21\x24\x6e\x1b\x29\x38\x0c\x1c\xad\xda\x34\x45\x19\xb9\x14\xab\x21\x41\xb6\xe9\x8f\xff\x7e\x4a\x02\x1b\x84\x52\xda\x3e\x61\xd9\xd7\x9f\x73\xb9\xe7\x38\x5e\x88\x56\x8b\x0d\xf9\x8d\x2f\x18\xd0\xeb\xc9\x85\x32\x98\xab\x67\x32\x58\x69\x7a\x54\xc5\xda\x60\xbd\x4a\x13\x4b\x06\xb6\xc0\xff\xfd\x2f\xb0\x8b\xc4\xe2\x89\x34\xa1\xc8\xb3\x17\xac\x12\x6d\x55\x92\x65\x2f\x48\x56\xab\x4c\x51\xda\xc7\x94\x08\xca\x98\x35\xe1\xbf\xaf\x97\x97\x15\x37\x9c\x5b\xca\x61\x4b\xba\x32\xf9\xb9\x45\x4e\x94\x52\x8a\x24\x4f\x61\x0a\x3c\xa9\x2c\x03\x69\x5d\x68\x14\x6b\xcb\x00\x27\x90\x7c\x02\xe9\x0c\x03\x8e\xa9\x7b\xcb\x47\x4e\xec\x3a\xd2\x09\xc2\x9b\xfe\x92\xac\x56\x33\x06\x78\x93\x70\x0c\x37\x0c\xa2\x91\x80\x4d\x7e\x67\x14\x9b\xd9\x82\x96\x49\xb7\x71\x66\x48\x2b\x32\x71\x55\xd2\x3c\x53\x26\x7e\x54\xf4\x54\x6e\x3b\x9e\x07\x37\x14\x53\x39\x71\x7c\x21\x81\xb3\x5a\x28\xde\xfc\xe4\xc9\x92\x6a\x46\xbd\x7c\xa0\x97\x33\x44\xc2\xff\x16\xf1\xf6\x4e\x49\x07\xbe\x70\x83\xc8\xe3\x68\xff\x2b\xee\xbc\xc5\x3f\xc2\xdc\xb9\x3d\x60\xfc\xce\xe5\x63\xe9\x87\x02\xdf\x6f\xb9\x40\x61\x17\xa4\x0d\x64\xb9\xee\xf5\xd4\x7d\x5e\x68\x62\x00\x20\xa2\x20\x18\x30\x2e\x3c\xd6\x6a\x0d\x18\x7b\xcf\x14\xb7\x8d\x1d\x8c\x11\xa5\x36\x44\x28\x2b\x2a\x3c\x7e\xed\x44\x81\xc4\xf9\x06\xe4\x39\xd2\x39\xef\x36\x01\xbb\xb3\xae\x00\x5d\xf4\x7a\xfb\xbb\xc6\x16\xba\x4c\xd3\xa2\x2e\x40\x31\xaf\xd6\xf5\xe1\xda\x50\x5a\x06\xad\x2a\xaa\xf6\xeb\xbb\x48\x13\x9b\x60\x5e\xe8\x3a\x43\x75\xf7\xfd\xa6\xfa\xc6\x4d\x0c\xc3\x30\xe0\x8e\x38\x6c\x7e\x9e\x64\x86\xea\xa6\x37\x29\xf8\xeb\xc7\x49\xb7\xdf\xbc\xf6\x5a\x69\xc3\xf0\xa3\x02\xf5\xb8\x1b\x88\x4d\x0c\xb0\x9b\xad\xee\x9e\x3f\xc7\x93\x76\x4c\xfa\xb4\x5c\x7b\xef\x1d\x61\x2f\x83\x2c\x1a\x7b\x8e\x3c\x12\x24\x4c\xb9\xdc\xb7\xf9\x6a\xe7\x76\x99\xda\x09\xc7\x05\xae\x70\x31\x38\x9d\xca\xcd\xeb\x7f\x2d\x52\xa5\xcc\xd6\xd5\x01\x63\x95\x1b\xd7\x91\x70\xab\xb7\xe1\x5f\x83\xdf\xf9\x53\x39\x6d\x62\xef\xc9\xc6\x87\x46\xa9\x79\x4c\xcf\xca\x58\xd3\x96\xfc\x4e\x76\x06\x1f\xa1\xcd\x8a\x7c\xae\xf4\x92\xd2\x78\x9d\x97\x99\x8d\xeb\x2e\xdb\x28\x51\x5d\x0c\xfd\x1b\x5f\xc8\x9f\xbf\xba\x90\xfe\x88\x4f\xa5\x33\x1a\xcb\x1f\xef\x57\x58\x26\xfa\xa1\x01\xae\xb9\x3b\xb4\x4f\xa2\x53\xca\xc8\x52\x4c\xcf\x2b\xa5\xdf\xa4\xd7\x7f\xe1\xb3\x2a\xba\x58\x6d\x27\x3e\x5b\xac\xf3\x87\xb8\x7c\xbf\x87\x32\x5b\xe2\x78\x12\xba\xdc\x8b\x26\xfc\x03\xc8\x53\x33\xe9\x6e\x3f\x03\x9d\x01\xfb\x13\x00\x00\xff\xff\xf4\x5a\xe7\xdb\xe7\x06\x00\x00"), }, "/versions/dev/0.5.2-dev/2-exemplar_objects.sql": &vfsgen۰CompressedFileInfo{ name: "2-exemplar_objects.sql", diff --git a/pkg/migrations/sql/versions/dev/0.5.2-dev/1-downsampling.sql b/pkg/migrations/sql/versions/dev/0.5.2-dev/1-downsampling.sql index 795dfcc82c..b41538a920 100644 --- a/pkg/migrations/sql/versions/dev/0.5.2-dev/1-downsampling.sql +++ b/pkg/migrations/sql/versions/dev/0.5.2-dev/1-downsampling.sql @@ -22,7 +22,7 @@ ALTER TABLE SCHEMA_CATALOG.metric ADD CONSTRAINT metric_metric_name_table_schema_table_name_key UNIQUE (metric_name, table_schema) INCLUDE (table_name), ADD CONSTRAINT metric_table_schema_table_name_key UNIQUE(table_schema, table_name); -UPDATE SCHEMA_CATALOG.metric SET series_table = table_name; +UPDATE SCHEMA_CATALOG.metric SET series_table = table_name WHERE 1 = 1; ALTER TABLE SCHEMA_CATALOG.metric ALTER COLUMN series_table SET NOT NULL; DROP FUNCTION IF EXISTS SCHEMA_CATALOG.get_metric_table_name_if_exists(TEXT);