Browse Source
Merge pull request #10694 from dashevchenko/schema_update_fix
Fixed schema_update.sql for case when attribute_kv is empty
pull/10713/head
Andrew Shvayka
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
7 deletions
-
application/src/main/data/upgrade/3.6.4/schema_update.sql
|
|
|
@ -107,13 +107,7 @@ BEGIN |
|
|
|
SELECT COUNT(*) INTO row_num_old FROM attribute_kv_old; |
|
|
|
SELECT COUNT(*) INTO row_num FROM attribute_kv; |
|
|
|
RAISE NOTICE 'Migrated % of % rows', row_num, row_num_old; |
|
|
|
|
|
|
|
IF row_num != 0 THEN |
|
|
|
DROP TABLE IF EXISTS attribute_kv_old; |
|
|
|
ELSE |
|
|
|
RAISE EXCEPTION 'Table attribute_kv is empty'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
DROP TABLE IF EXISTS attribute_kv_old; |
|
|
|
CREATE INDEX IF NOT EXISTS idx_attribute_kv_by_key_and_last_update_ts ON attribute_kv(entity_id, attribute_key, last_update_ts desc); |
|
|
|
END IF; |
|
|
|
EXCEPTION |
|
|
|
|