-- phpMyAdmin SQL Dump -- version 5.2.1 -- https://www.phpmyadmin.net/ -- -- 主机: 114.5.1.4 -- 生成日期: 2024-10-19 06:27:45 -- 服务器版本: 8.4.2 -- PHP 版本: 8.2.23 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- 数据库: `ez_site` -- -- -------------------------------------------------------- -- -- 表的结构 `articles` -- CREATE TABLE `articles` ( `id` int NOT NULL, `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `type` enum('activity','news') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -- 表的结构 `comments` -- CREATE TABLE `comments` ( `id` int NOT NULL, `user_id` int DEFAULT NULL, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `love_wall_id` int DEFAULT NULL, `article_id` int DEFAULT NULL, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -- 表的结构 `love_wall` -- CREATE TABLE `love_wall` ( `id` int NOT NULL, `user_id` int DEFAULT NULL, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -- 表的结构 `users` -- CREATE TABLE `users` ( `id` int NOT NULL, `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, `group` enum('admin','user') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'user', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `phone_number` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -- 转储表的索引 -- -- -- 表的索引 `articles` -- ALTER TABLE `articles` ADD PRIMARY KEY (`id`); -- -- 表的索引 `comments` -- ALTER TABLE `comments` ADD PRIMARY KEY (`id`), ADD KEY `user_id` (`user_id`), ADD KEY `love_wall_id` (`love_wall_id`), ADD KEY `article_id` (`article_id`); -- -- 表的索引 `love_wall` -- ALTER TABLE `love_wall` ADD PRIMARY KEY (`id`), ADD KEY `user_id` (`user_id`); -- -- 表的索引 `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `articles` -- ALTER TABLE `articles` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- 使用表AUTO_INCREMENT `comments` -- ALTER TABLE `comments` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- 使用表AUTO_INCREMENT `love_wall` -- ALTER TABLE `love_wall` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- 使用表AUTO_INCREMENT `users` -- ALTER TABLE `users` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82; -- -- 限制导出的表 -- -- -- 限制表 `comments` -- ALTER TABLE `comments` ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`love_wall_id`) REFERENCES `love_wall` (`id`), ADD CONSTRAINT `comments_ibfk_3` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`); -- -- 限制表 `love_wall` -- ALTER TABLE `love_wall` ADD CONSTRAINT `love_wall_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;