chore(auth): Phase 3 cheap prep — nullable org_id + OrgContext skeleton
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
<?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">
|
||||
|
||||
<!--
|
||||
Phase 3 cheap prep — заранее добавить nullable org_id колонки в core
|
||||
data-таблицы. Никакая логика не использует эти колонки сейчас (нет
|
||||
entity полей, нет фильтров, нет индексов). Цель: при старте полноценного
|
||||
Phase 3 (multi-tenant org-scoping) миграция становится трiviальной —
|
||||
UPDATE для backfill + ALTER NOT NULL + индекс, без блокирующего
|
||||
ADD COLUMN на больших таблицах.
|
||||
|
||||
Что НЕ добавлено сюда (отложено до Phase 3):
|
||||
- JPA @Column поля на entities — мусор в текущей модели.
|
||||
- Index'ы на org_id — пока NULL у всех строк, индекс бесполезен и
|
||||
просто занимает место.
|
||||
- NOT NULL constraint — только после backfill.
|
||||
- FK к organizations таблице — её ещё нет (org_id это UUID из
|
||||
altum-auth realm, не локальный FK).
|
||||
- Колонки в schema_drafts, record_drafts, user_display_cache —
|
||||
могут не понадобиться (drafts могут быть привязаны через dictionary
|
||||
JOIN; user_display_cache юзер может быть в нескольких orgs).
|
||||
Решение перенесём на Phase 3 когда дизайн будет конкретнее.
|
||||
|
||||
Контекст: altum auth-service кладёт `organization` claim в JWT (array
|
||||
of org UUIDs). Phase 3 будет filterить queries по этому claim'у.
|
||||
Сейчас realm `altum` имеет одну org ("nstart"), так что cheap prep
|
||||
не активирует никакого мulti-tenancy — это чисто инфра-задел.
|
||||
|
||||
См. checkpoint 20260526-154800-phase2-audited-users-scope-fix.md
|
||||
раздел "Phase 3 cheap preparation".
|
||||
-->
|
||||
|
||||
<changeSet id="0028-1-dictionary-definitions-org-id" author="ordinis">
|
||||
<comment>Phase 3 prep: nullable org_id на dictionary_definitions</comment>
|
||||
<addColumn tableName="dictionary_definitions">
|
||||
<column name="org_id" type="UUID">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="0028-2-dictionary-records-org-id" author="ordinis">
|
||||
<comment>Phase 3 prep: nullable org_id на dictionary_records</comment>
|
||||
<addColumn tableName="dictionary_records">
|
||||
<column name="org_id" type="UUID">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="0028-3-audit-log-org-id" author="ordinis">
|
||||
<comment>Phase 3 prep: nullable org_id на audit_log</comment>
|
||||
<addColumn tableName="audit_log">
|
||||
<column name="org_id" type="UUID">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -37,5 +37,6 @@
|
||||
<include file="changes/0025-notification-prefs-event-type.xml" relativeToChangelogFile="true"/>
|
||||
<include file="changes/0026-notification-quiet-hours.xml" relativeToChangelogFile="true"/>
|
||||
<include file="changes/0027-spacecraft-mission-fk.xml" relativeToChangelogFile="true"/>
|
||||
<include file="changes/0028-phase3-prep-org-id.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
Reference in New Issue
Block a user