diff --git a/src/main/kotlin/org/wfanet/measurement/integration/deploy/postgres/ledger.sql b/src/main/kotlin/org/wfanet/measurement/integration/deploy/postgres/ledger.sql index 6a7d9fb125e..51d6ec27914 100644 --- a/src/main/kotlin/org/wfanet/measurement/integration/deploy/postgres/ledger.sql +++ b/src/main/kotlin/org/wfanet/measurement/integration/deploy/postgres/ledger.sql @@ -41,6 +41,25 @@ CREATE TABLE PrivacyBucketCharges( PRIMARY KEY (MeasurementConsumerId, Date, AgeGroup, Gender, VidStart, Delta, Epsilon) ); +CREATE TABLE PrivacyBucketAcdpCharges( + -- Which Measurement Consumer this PrivacyBucket belongs to. + MeasurementConsumerId text NOT NULL, + -- Day for this PrivacyBucket. DD-MM-YYYY. + Date Date NOT NULL, + -- Age for this PrivacyBucket. + AgeGroup AgeGroup NOT NULL, + -- Gender for this PrivacyBucket. + Gender Gender NOT NULL, + -- Start of the Vid range for this PrivacyBucket. Bucket vid's ranges from VidStart to VidStart + 0.1. + VidStart real NOT NULL, + -- Rho for the AcdpCharge of this ledger entry. + Rho real NOT NULL, + -- Theta for the AcdpCharge of this ledger entry. + Theta real NOT NULL, + -- Used to query entries efficiently to update rho and theta. + PRIMARY KEY (MeasurementConsumerId, Date, AgeGroup, Gender, VidStart) + ); + CREATE TABLE LedgerEntries( -- Which Measurement Consumer this Ledger Entry belongs to. MeasurementConsumerId text NOT NULL, diff --git a/src/test/kotlin/org/wfanet/measurement/eventdataprovider/privacybudgetmanagement/deploy/postgres/PostgresBackingStoreTest.kt b/src/test/kotlin/org/wfanet/measurement/eventdataprovider/privacybudgetmanagement/deploy/postgres/PostgresBackingStoreTest.kt index c2570c55053..6353550c98a 100644 --- a/src/test/kotlin/org/wfanet/measurement/eventdataprovider/privacybudgetmanagement/deploy/postgres/PostgresBackingStoreTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/eventdataprovider/privacybudgetmanagement/deploy/postgres/PostgresBackingStoreTest.kt @@ -62,6 +62,7 @@ class PostgresBackingStoreTest : AbstractPrivacyBudgetLedgerStoreTest() { """ DROP TABLE IF EXISTS LedgerEntries CASCADE; DROP TABLE IF EXISTS PrivacyBucketCharges CASCADE; + DROP TABLE IF EXISTS PrivacyBucketAcdpCharges CASCADE; DROP TYPE IF EXISTS Gender CASCADE; DROP TYPE IF EXISTS AgeGroup CASCADE; """