---
apiVersion: data-spec/v1
id: drop-flow-package-ownership-tables-20260424
description: "Drop the abandoned `_System_MetadataPackage` and `_System_FlowDefinitionPackageOwnership` tables introduced by the branch-local flow ownership experiment after the mixed Path C pivot (`FlowDefinition.IsCustomized + Flow.Source`)."
title: "Drop abandoned flow package ownership tables"
issue: "#1848"
created: 2026-04-24
scope: both
status: pending
tables_modified:
  - _System_MetadataPackage
  - _System_FlowDefinitionPackageOwnership
tables: [_System_MetadataPackage, _System_FlowDefinitionPackageOwnership]
idempotent: true
risk: medium
depends_on: []
---

# Drop abandoned flow package ownership tables

## Summary

The branch briefly introduced a flow-specific package ownership subsystem with
two tables:

- `_System_MetadataPackage`
- `_System_FlowDefinitionPackageOwnership`

The final design for issue `#1848` does **not** use that subsystem. Ownership
is now represented by `FlowDefinition.IsCustomized` at the definition layer,
while version provenance remains on `Flow.Source`.

These two tables are therefore legacy debt from an abandoned branch direction.
If a dev, CI, or upgraded cluster ever booted a binary that reconciled them
into the schema, they should be dropped so the live catalog matches the final
mixed Path C design.

Any rows present in these tables may be discarded. They were branch-local
provenance state for a rejected design and are not part of the supported
runtime model.

## Preconditions

- The mixed Path C code (`FlowDefinition.IsCustomized` + `Flow.Source`) is
  deployed to the target environment.
- No running binary still references `_System_MetadataPackage` or
  `_System_FlowDefinitionPackageOwnership`.

## Changes

### 1. Drop `_System_FlowDefinitionPackageOwnership`

```sql
DROP TABLE IF EXISTS `_System_FlowDefinitionPackageOwnership`;
```

Idempotency: `DROP TABLE IF EXISTS` is a no-op when the table was never created
on this cluster or was already dropped by an earlier apply.

### 2. Drop `_System_MetadataPackage`

```sql
DROP TABLE IF EXISTS `_System_MetadataPackage`;
```

Idempotency: `DROP TABLE IF EXISTS` is a no-op when the table was never created
on this cluster or was already dropped by an earlier apply.

## Verification

```sql
SHOW TABLES LIKE '_System_MetadataPackage';
-- Expected: empty result

SHOW TABLES LIKE '_System_FlowDefinitionPackageOwnership';
-- Expected: empty result
```

## Rollback

This cleanup is not directly reversible from SQL alone. If rollback is needed,
restore the tables by checking out the abandoned package-ownership branch code
that declared them in `backend/internal/bootstrap/system_tables.json` and let
schema reconcile recreate the tables. The row contents themselves do not need
to be preserved because they represented discarded branch-local ownership
metadata rather than supported product state.
