refactor(contribution): 合并 source_type 迁移到 0001_init
将 0003_add_source_type 迁移合并到 0001_init/migration.sql Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e7260be219
commit
21c6c25f7c
|
|
@ -248,6 +248,10 @@ CREATE TABLE "system_contribution_records" (
|
|||
"system_account_id" BIGINT NOT NULL,
|
||||
"source_adoption_id" BIGINT NOT NULL,
|
||||
"source_account_sequence" VARCHAR(20) NOT NULL,
|
||||
-- 来源类型: FIXED_RATE(固定比例) / LEVEL_OVERFLOW(层级溢出) / LEVEL_NO_ANCESTOR(无上线) / BONUS_TIER_1/2/3(团队奖励未解锁)
|
||||
"source_type" VARCHAR(30) NOT NULL,
|
||||
-- 层级深度(1-15),仅对 LEVEL_OVERFLOW 和 LEVEL_NO_ANCESTOR 类型有效
|
||||
"level_depth" INTEGER,
|
||||
"distribution_rate" DECIMAL(10,6) NOT NULL,
|
||||
"amount" DECIMAL(30,10) NOT NULL,
|
||||
"effective_date" DATE NOT NULL,
|
||||
|
|
@ -260,6 +264,7 @@ CREATE TABLE "system_contribution_records" (
|
|||
|
||||
CREATE INDEX "system_contribution_records_system_account_id_idx" ON "system_contribution_records"("system_account_id");
|
||||
CREATE INDEX "system_contribution_records_source_adoption_id_idx" ON "system_contribution_records"("source_adoption_id");
|
||||
CREATE INDEX "system_contribution_records_source_type_idx" ON "system_contribution_records"("source_type");
|
||||
|
||||
ALTER TABLE "system_contribution_records" ADD CONSTRAINT "system_contribution_records_system_account_id_fkey" FOREIGN KEY ("system_account_id") REFERENCES "system_accounts"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
-- AlterTable: Add source_type and level_depth columns to system_contribution_records
|
||||
-- source_type: FIXED_RATE(固定比例分配) / LEVEL_OVERFLOW(层级溢出) / LEVEL_NO_ANCESTOR(无上线) / BONUS_TIER_1/2/3(团队奖励未解锁)
|
||||
-- level_depth: 层级深度(1-15),仅对 LEVEL_OVERFLOW 和 LEVEL_NO_ANCESTOR 类型有效
|
||||
|
||||
ALTER TABLE "system_contribution_records" ADD COLUMN "source_type" VARCHAR(30) NOT NULL DEFAULT 'FIXED_RATE';
|
||||
ALTER TABLE "system_contribution_records" ADD COLUMN "level_depth" INTEGER;
|
||||
|
||||
-- Remove default after adding column (existing records are FIXED_RATE)
|
||||
ALTER TABLE "system_contribution_records" ALTER COLUMN "source_type" DROP DEFAULT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "system_contribution_records_source_type_idx" ON "system_contribution_records"("source_type");
|
||||
Loading…
Reference in New Issue