Compare commits
3 Commits
7d552d33cd
...
bff25b4683
| Author | SHA1 | Date | |
|---|---|---|---|
| bff25b4683 | |||
| aa1d22cec7 | |||
| f7e97ad7a2 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -137,3 +137,6 @@ GerbilManagerWebAPI/photo-storage/
|
|||||||
|
|
||||||
# AR-3: Data Protection key ring (dev-only ephemeral keys) — never commit
|
# AR-3: Data Protection key ring (dev-only ephemeral keys) — never commit
|
||||||
GerbilManagerWebAPI/.data-protection-keys/
|
GerbilManagerWebAPI/.data-protection-keys/
|
||||||
|
|
||||||
|
# node_modules — never commit, installed locally per npm install
|
||||||
|
node_modules/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace GerbilManagerWebAPI.Migrations
|
|||||||
UPDATE ""Gerbils"" SET ""Status"" = 'GivenAway'
|
UPDATE ""Gerbils"" SET ""Status"" = 'GivenAway'
|
||||||
WHERE ""Status"" != 'Deceased'
|
WHERE ""Status"" != 'Deceased'
|
||||||
AND (""ReceiverContactId"" IS NOT NULL
|
AND (""ReceiverContactId"" IS NOT NULL
|
||||||
OR EXISTS (SELECT 1 FROM ""SaleContractAnimals"" WHERE ""GerbilId"" = ""Gerbils"".""Id""));");
|
OR EXISTS (SELECT 1 FROM ""SaleContractAnimal"" WHERE ""GerbilId"" = ""Gerbils"".""Id""));");
|
||||||
|
|
||||||
// 4) Age > 7 years (presumed dead) → Deceased, but NOT overriding GivenAway.
|
// 4) Age > 7 years (presumed dead) → Deceased, but NOT overriding GivenAway.
|
||||||
migrationBuilder.Sql(@"
|
migrationBuilder.Sql(@"
|
||||||
|
|||||||
32
tools/wipe-import-data.sql
Normal file
32
tools/wipe-import-data.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- WIPE-IMPORT-DATA: truncate only import-derived tables, preserve seeded data.
|
||||||
|
--
|
||||||
|
-- Scope (god decision 2026-06-07):
|
||||||
|
-- WIPE: GerbilPhotos, WeightRecords, HealthRecords, Gerbils, Litters
|
||||||
|
-- KEEP: ColorVarieties (migration-seeded, import matches against these)
|
||||||
|
-- BreederSettings, Sites, Pages (CMS), Contacts, Enclosures,
|
||||||
|
-- SaleContracts, Requests, MailSettings
|
||||||
|
--
|
||||||
|
-- Run ONLY after pg_dump backup. FK order: dependents first.
|
||||||
|
-- Usage (with Aspire Postgres running):
|
||||||
|
-- docker exec -i <postgres-container> psql -U postgres gerbilmanager < tools/wipe-import-data.sql
|
||||||
|
-- OR connect via psql and \i this file.
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- 1. leaf dependents
|
||||||
|
TRUNCATE TABLE "GerbilPhotos" CASCADE;
|
||||||
|
TRUNCATE TABLE "WeightRecords" CASCADE;
|
||||||
|
TRUNCATE TABLE "HealthRecords" CASCADE;
|
||||||
|
|
||||||
|
-- 2. main import tables (Gerbils before Litters: Gerbil.LitterId FK)
|
||||||
|
TRUNCATE TABLE "Gerbils" CASCADE;
|
||||||
|
TRUNCATE TABLE "Litters" CASCADE;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- Verify (expected: 0 rows each)
|
||||||
|
SELECT 'GerbilPhotos' AS tbl, COUNT(*) FROM "GerbilPhotos"
|
||||||
|
UNION ALL SELECT 'WeightRecords', COUNT(*) FROM "WeightRecords"
|
||||||
|
UNION ALL SELECT 'HealthRecords', COUNT(*) FROM "HealthRecords"
|
||||||
|
UNION ALL SELECT 'Gerbils', COUNT(*) FROM "Gerbils"
|
||||||
|
UNION ALL SELECT 'Litters', COUNT(*) FROM "Litters";
|
||||||
Reference in New Issue
Block a user