Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS ACCOUNT
UNIQUE KEY uk_account_connection_hash (codef_connection_id, account_no_hash),
INDEX ix_account_user_status (user_id, status),
CONSTRAINT fk_account_codef_connection FOREIGN KEY (codef_connection_id)
REFERENCES CODEF_CONNECTION (codef_connection_id)
REFERENCES CODEF_CONNECTION (codef_connection_id) ON DELETE CASCADE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

Expand All @@ -95,7 +95,7 @@ CREATE TABLE IF NOT EXISTS ACCOUNT_TRANSACTION
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_account_transaction_fingerprint (account_id, fingerprint),
INDEX ix_account_transaction_account_date (account_id, tran_date),
CONSTRAINT fk_account_transaction_account FOREIGN KEY (account_id) REFERENCES ACCOUNT (account_id)
CONSTRAINT fk_account_transaction_account FOREIGN KEY (account_id) REFERENCES ACCOUNT (account_id) ON DELETE CASCADE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

Expand Down Expand Up @@ -135,7 +135,7 @@ CREATE TABLE IF NOT EXISTS ACCOUNT_SYNC_STATE
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_account_sync_state_connection_org (codef_connection_id, organization_code),
CONSTRAINT fk_account_sync_state_codef_connection FOREIGN KEY (codef_connection_id)
REFERENCES CODEF_CONNECTION (codef_connection_id)
REFERENCES CODEF_CONNECTION (codef_connection_id) ON DELETE CASCADE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

Expand All @@ -154,6 +154,6 @@ CREATE TABLE IF NOT EXISTS TXN_ANALYSIS

CONSTRAINT fk_txn_analysis_transaction
FOREIGN KEY (account_transaction_id)
REFERENCES ACCOUNT_TRANSACTION (account_transaction_id)
REFERENCES ACCOUNT_TRANSACTION (account_transaction_id) ON DELETE CASCADE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ALTER TABLE `PAYMENT` ADD CONSTRAINT `FK_SUBSCRIPTION_TO_PAYMENT_1` FOREIGN KEY
)
REFERENCES `SUBSCRIPTION` (
`subscription_id`
);
) ON DELETE CASCADE;

-- ============================================================
-- Unique Constraint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ CREATE TABLE `ALLOCATION_GOAL` (
`allocation_goal_id` BIGINT NOT NULL AUTO_INCREMENT,
`job_id` BIGINT NOT NULL,
`target_month` VARCHAR(7) NOT NULL,
`recommend_hour` BIGINT NOT NULL
`recommend_hour` BIGINT NOT NULL,
PRIMARY KEY (`allocation_goal_id`)
);

-- 8. SAVING_GOAL (월별 저축 목표: 목표 소득액 + 적정 피로도)
Expand Down Expand Up @@ -147,10 +148,6 @@ ALTER TABLE `PLATFORM` ADD CONSTRAINT `PK_PLATFORM` PRIMARY KEY (
`platform_id`
);

ALTER TABLE `ALLOCATION_GOAL` ADD CONSTRAINT `PK_ALLOCATION_GOAL` PRIMARY KEY (
`allocation_goal_id`
);

-- ============================================================
-- Foreign Key (work-service 내부 참조만 - 서비스 내부는 FK 유지)
-- ============================================================
Expand All @@ -174,7 +171,7 @@ ALTER TABLE `JOBPLATFORMMAPPING` ADD CONSTRAINT `FK_JOB_TO_JOBPLATFORMMAPPING_1`
)
REFERENCES `JOB` (
`job_id`
);
) ON DELETE CASCADE;

ALTER TABLE `JOBPLATFORMMAPPING` ADD CONSTRAINT `FK_PLATFORM_TO_JOBPLATFORMMAPPING_1` FOREIGN KEY (
`platform_id`
Expand All @@ -188,21 +185,21 @@ ALTER TABLE `JOB_SCHEDULE` ADD CONSTRAINT `FK_JOB_TO_JOB_SCHEDULE_1` FOREIGN KEY
)
REFERENCES `JOB` (
`job_id`
);
) ON DELETE CASCADE;

ALTER TABLE `WORK_LOG` ADD CONSTRAINT `FK_JOB_TO_WORK_LOG_1` FOREIGN KEY (
`job_id`
)
REFERENCES `JOB` (
`job_id`
);
) ON DELETE CASCADE;

ALTER TABLE `WORK_LOG_PLATFORM_INCOME` ADD CONSTRAINT `FK_WORK_LOG_TO_WORK_LOG_PLATFORM_INCOME_1` FOREIGN KEY (
`log_id`
)
REFERENCES `WORK_LOG` (
`log_id`
);
) ON DELETE CASCADE;

ALTER TABLE `WORK_LOG_PLATFORM_INCOME` ADD CONSTRAINT `FK_PLATFORM_TO_WORK_LOG_PLATFORM_INCOME_1` FOREIGN KEY (
`platform_id`
Expand All @@ -216,14 +213,14 @@ ALTER TABLE `SETTLEMENT` ADD CONSTRAINT `FK_JOB_TO_SETTLEMENT_1` FOREIGN KEY (
)
REFERENCES `JOB` (
`job_id`
);
) ON DELETE CASCADE;

ALTER TABLE `ALLOCATION_GOAL` ADD CONSTRAINT `FK_JOB_TO_ALLOCATION_GOAL_1` FOREIGN KEY (
`job_id`
)
REFERENCES `JOB` (
`job_id`
);
) ON DELETE CASCADE;

-- ============================================================
-- Index (job_id 기준 - 체크리스트 항목)
Expand Down
Loading