fix(migrations): drop actual records scope_check constraint (was named _scope_check, not _data_scope_check)

0008 dropped IF EXISTS dictionary_records_data_scope_check, но реальный
constraint в 0003 назывался dictionary_records_scope_check (без _data_).
Старый lowercase constraint остался жив — записи с UPPERCASE
data_scope не проходили. 0009 удаляет оба варианта имени и создаёт
UPPERCASE constraint.
This commit is contained in:
Александр Зимин
2026-05-03 23:45:14 +03:00
parent 0752b3acd6
commit add0394e32
2 changed files with 23 additions and 0 deletions
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.27.xsd">
<changeSet id="0009-1-fix-records-scope-check-actual-name" author="ordinis">
<comment>В 0003 constraint назывался dictionary_records_scope_check (а не _data_scope_check как
ожидала 0008). Дропаем правильное имя и пересоздаём с UPPERCASE.</comment>
<sql>
ALTER TABLE dictionary_records
DROP CONSTRAINT IF EXISTS dictionary_records_scope_check;
ALTER TABLE dictionary_records
DROP CONSTRAINT IF EXISTS dictionary_records_data_scope_check;
ALTER TABLE dictionary_records
ADD CONSTRAINT dictionary_records_data_scope_check
CHECK (data_scope IN ('PUBLIC', 'INTERNAL', 'RESTRICTED'));
</sql>
</changeSet>
</databaseChangeLog>
@@ -13,5 +13,6 @@
<include file="changes/0006-idempotency-keys.xml"/> <include file="changes/0006-idempotency-keys.xml"/>
<include file="changes/0007-add-version-columns.xml"/> <include file="changes/0007-add-version-columns.xml"/>
<include file="changes/0008-fix-scope-check-uppercase.xml"/> <include file="changes/0008-fix-scope-check-uppercase.xml"/>
<include file="changes/0009-fix-records-scope-check.xml"/>
</databaseChangeLog> </databaseChangeLog>