feat: 完成后端API路由、交易服务和数据库模式的初始搭建

This commit is contained in:
2026-01-30 15:40:50 +08:00
parent c4d7825328
commit 8518b35d7f
3 changed files with 40 additions and 2 deletions

View File

@@ -167,6 +167,13 @@ CREATE TABLE IF NOT EXISTS `transaction_tags` (
CONSTRAINT `fk_transaction_tags_transaction` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Account Tags table (Many-to-Many)
CREATE TABLE IF NOT EXISTS `account_tags` (
`account_id` bigint(20) unsigned NOT NULL,
`tag_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`account_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Transaction Images table
CREATE TABLE IF NOT EXISTS `transaction_images` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -553,6 +560,7 @@ CREATE TABLE IF NOT EXISTS `user_settings` (
CONSTRAINT `fk_user_settings_default_expense` FOREIGN KEY (`default_expense_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_user_settings_default_income` FOREIGN KEY (`default_income_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Notifications table
CREATE TABLE IF NOT EXISTS `notifications` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,