From 7d3827de064a87b9c8316d0733199a81e3eeb47f Mon Sep 17 00:00:00 2001 From: y11n Date: Wed, 22 Oct 2025 17:24:35 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20user=5Fmonthly=5Fstat=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=83=9D=EC=84=B1=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/V2__create_user_monthly_stat_table.sql | 10 ++++++++++ ...ckfill_user_monthly_stat_from_existing_records.sql} | 0 2 files changed, 10 insertions(+) create mode 100644 src/main/resources/db/migration/V2__create_user_monthly_stat_table.sql rename src/main/resources/db/migration/{V2__backfill_user_monthly_stat_from_existing_records.sql => V3__backfill_user_monthly_stat_from_existing_records.sql} (100%) diff --git a/src/main/resources/db/migration/V2__create_user_monthly_stat_table.sql b/src/main/resources/db/migration/V2__create_user_monthly_stat_table.sql new file mode 100644 index 0000000..fac2923 --- /dev/null +++ b/src/main/resources/db/migration/V2__create_user_monthly_stat_table.sql @@ -0,0 +1,10 @@ +CREATE TABLE user_monthly_stat ( + id BIGSERIAL PRIMARY KEY, + user_id BIGINT NOT NULL, + year INT NOT NULL, + month INT NOT NULL, + record_count INT NOT NULL DEFAULT 0, + CONSTRAINT uq_user_monthly_stat UNIQUE (user_id, year, month), + CONSTRAINT fk_user_monthly_stat_user FOREIGN KEY (user_id) + REFERENCES users(id) +); diff --git a/src/main/resources/db/migration/V2__backfill_user_monthly_stat_from_existing_records.sql b/src/main/resources/db/migration/V3__backfill_user_monthly_stat_from_existing_records.sql similarity index 100% rename from src/main/resources/db/migration/V2__backfill_user_monthly_stat_from_existing_records.sql rename to src/main/resources/db/migration/V3__backfill_user_monthly_stat_from_existing_records.sql