feat: 初始化数据库模式并引入AI记账服务。
This commit is contained in:
@@ -553,3 +553,25 @@ 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,
|
||||
`created_at` datetime(3) DEFAULT NULL,
|
||||
`updated_at` datetime(3) DEFAULT NULL,
|
||||
`deleted_at` datetime(3) DEFAULT NULL,
|
||||
`user_id` bigint(20) unsigned NOT NULL,
|
||||
`title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'system',
|
||||
`is_read` tinyint(1) DEFAULT '0',
|
||||
`link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`read_at` datetime(3) DEFAULT NULL,
|
||||
`related_id` bigint(20) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_notifications_deleted_at` (`deleted_at`),
|
||||
KEY `idx_notifications_user_id` (`user_id`),
|
||||
KEY `idx_notifications_type` (`type`),
|
||||
KEY `idx_notifications_is_read` (`is_read`),
|
||||
KEY `idx_notifications_related_id` (`related_id`),
|
||||
CONSTRAINT `fk_users_notifications` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
Reference in New Issue
Block a user