删除 init.sql
This commit is contained in:
1 parent
af8c64378c
commit
f6dd372456
1 file changed
-45
@@ -1,45 +0,0 @@
|
||||
-- 创建数据库
|
||||
CREATE DATABASE IF NOT EXISTS nav_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
USE nav_db;
|
||||
|
||||
-- 1. 用户表
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`username` VARCHAR(50) NOT NULL UNIQUE,
|
||||
`password` VARCHAR(255) NOT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- 2. 导航条目表
|
||||
CREATE TABLE IF NOT EXISTS `nav_items` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`title` VARCHAR(100) NOT NULL,
|
||||
`url` VARCHAR(255) DEFAULT NULL,
|
||||
`description` TEXT,
|
||||
`image_large` VARCHAR(255),
|
||||
`image_thumb` VARCHAR(255),
|
||||
`status` ENUM('enabled', 'disabled', 'construction', 'offline') DEFAULT 'enabled',
|
||||
`sort_weight` INT DEFAULT 0,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- 3. 全局配置表
|
||||
CREATE TABLE IF NOT EXISTS `settings` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`config_key` VARCHAR(50) NOT NULL UNIQUE,
|
||||
`config_value` TEXT,
|
||||
`is_enabled` TINYINT(1) DEFAULT 0
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- 插入默认管理员 (密码: admin123)
|
||||
-- 注意:实际哈希会在 app.py 首次运行时由程序生成以保证兼容性
|
||||
INSERT INTO `users` (`username`, `password`) VALUES
|
||||
('admin', 'pbkdf2:sha256:260000$v9mB5NlD$0c0c0e3a6c1a8e9e7b4b1a2c3d4e5f6g7h8i9j0k');
|
||||
|
||||
INSERT INTO `settings` (`config_key`, `config_value`, `is_enabled`) VALUES
|
||||
('popup_config', '欢迎来到现代导航系统!', 1);
|
||||
|
||||
INSERT INTO `nav_items` (`title`, `url`, `description`, `image_large`, `image_thumb`, `status`, `sort_weight`) VALUES
|
||||
('Google', 'https://www.google.com', '全球领先的搜索引擎。', 'https://images.unsplash.com/photo-1573804633927-bfcbcd909acd?auto=format&fit=crop&q=80&w=1920', 'https://images.unsplash.com/photo-1573804633927-bfcbcd909acd?auto=format&fit=crop&q=80&w=400', 'enabled', 100),
|
||||
('建设中项目', NULL, '这是一个正在建设中的示例条目。', 'https://images.unsplash.com/photo-1503387762-592dea58ef23?auto=format&fit=crop&q=80&w=1920', 'https://images.unsplash.com/photo-1503387762-592dea58ef23?auto=format&fit=crop&q=80&w=400', 'construction', 50),
|
||||
('离线资源', 'https://example.com', '该资源目前已离线。', 'https://images.unsplash.com/photo-1555066931-4365d14bab8c?auto=format&fit=crop&q=80&w=1920', 'https://images.unsplash.com/photo-1555066931-4365d14bab8c?auto=format&fit=crop&q=80&w=400', 'offline', 10);
|
||||
Reference in new issue
Block a user