6-315/GJ.sql

336 lines
18 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
SQLyog Trial v12.4.1 (64 bit)
MySQL - 5.7.28-log : Database - gjj
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`gjj` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `gjj`;
/*Table structure for table `auth_group` */
DROP TABLE IF EXISTS `auth_group`;
CREATE TABLE `auth_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `auth_group` */
/*Table structure for table `auth_group_permissions` */
DROP TABLE IF EXISTS `auth_group_permissions`;
CREATE TABLE `auth_group_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),
KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`),
CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `auth_group_permissions` */
/*Table structure for table `auth_permission` */
DROP TABLE IF EXISTS `auth_permission`;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`),
CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
/*Data for the table `auth_permission` */
insert into `auth_permission`(`id`,`name`,`content_type_id`,`codename`) values
(1,'Can add log entry',1,'add_logentry'),
(2,'Can change log entry',1,'change_logentry'),
(3,'Can delete log entry',1,'delete_logentry'),
(4,'Can view log entry',1,'view_logentry'),
(5,'Can add permission',2,'add_permission'),
(6,'Can change permission',2,'change_permission'),
(7,'Can delete permission',2,'delete_permission'),
(8,'Can view permission',2,'view_permission'),
(9,'Can add group',3,'add_group'),
(10,'Can change group',3,'change_group'),
(11,'Can delete group',3,'delete_group'),
(12,'Can view group',3,'view_group'),
(13,'Can add content type',4,'add_contenttype'),
(14,'Can change content type',4,'change_contenttype'),
(15,'Can delete content type',4,'delete_contenttype'),
(16,'Can view content type',4,'view_contenttype'),
(17,'Can add session',5,'add_session'),
(18,'Can change session',5,'change_session'),
(19,'Can delete session',5,'delete_session'),
(20,'Can view session',5,'view_session'),
(21,'Can add 用户信息',6,'add_user'),
(22,'Can change 用户信息',6,'change_user'),
(23,'Can delete 用户信息',6,'delete_user'),
(24,'Can view 用户信息',6,'view_user'),
(25,'Can add 类别管理',7,'add_articlecategory'),
(26,'Can change 类别管理',7,'change_articlecategory'),
(27,'Can delete 类别管理',7,'delete_articlecategory'),
(28,'Can view 类别管理',7,'view_articlecategory'),
(29,'Can add 文章管理',8,'add_article'),
(30,'Can change 文章管理',8,'change_article'),
(31,'Can delete 文章管理',8,'delete_article'),
(32,'Can view 文章管理',8,'view_article');
/*Table structure for table `django_admin_log` */
DROP TABLE IF EXISTS `django_admin_log`;
CREATE TABLE `django_admin_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`action_time` datetime(6) NOT NULL,
`object_id` longtext,
`object_repr` varchar(200) NOT NULL,
`action_flag` smallint(5) unsigned NOT NULL,
`change_message` longtext NOT NULL,
`content_type_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`),
KEY `django_admin_log_user_id_c564eba6_fk_tb_user_id` (`user_id`),
CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),
CONSTRAINT `django_admin_log_user_id_c564eba6_fk_tb_user_id` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
/*Data for the table `django_admin_log` */
insert into `django_admin_log`(`id`,`action_time`,`object_id`,`object_repr`,`action_flag`,`change_message`,`content_type_id`,`user_id`) values
(1,'2021-12-31 05:41:48.714462','1','python',1,'[{\"added\": {}}]',7,9),
(2,'2021-12-31 05:41:52.611877','2','java',1,'[{\"added\": {}}]',7,9),
(3,'2021-12-31 05:43:30.884170','3','HTML',1,'[{\"added\": {}}]',7,9),
(4,'2021-12-31 05:43:52.027407','4','测试',1,'[{\"added\": {}}]',7,9),
(5,'2021-12-31 05:43:59.444791','5','PHP',1,'[{\"added\": {}}]',7,9),
(6,'2021-12-31 10:07:34.732290','6','python',1,'[{\"added\": {}}]',7,9),
(7,'2021-12-31 10:07:38.174993','7','java',1,'[{\"added\": {}}]',7,9),
(8,'2021-12-31 10:07:40.242198','8','HTML',1,'[{\"added\": {}}]',7,9),
(9,'2021-12-31 10:07:42.287717','9','测试',1,'[{\"added\": {}}]',7,9),
(10,'2021-12-31 10:07:44.829902','10','PHP',1,'[{\"added\": {}}]',7,9),
(11,'2021-12-31 12:54:58.032722','10','PHP',3,'',7,9),
(12,'2021-12-31 12:55:20.428863','9','测试',3,'',7,9),
(13,'2021-12-31 12:55:20.438828','8','HTML',3,'',7,9),
(14,'2021-12-31 12:55:20.442614','7','java',3,'',7,9),
(15,'2021-12-31 12:55:20.450775','6','python',3,'',7,9),
(16,'2021-12-31 12:55:45.257611','5','PHP',3,'',7,9),
(17,'2021-12-31 12:55:45.267098','4','测试',3,'',7,9),
(18,'2021-12-31 12:55:45.276157','3','HTML',3,'',7,9),
(19,'2021-12-31 14:35:15.133706','11','C',1,'[{\"added\": {}}]',7,9),
(20,'2021-12-31 14:35:23.545172','12','C++',1,'[{\"added\": {}}]',7,9),
(21,'2022-01-01 02:20:45.014453','1','Python',2,'[{\"changed\": {\"fields\": [\"title\"]}}]',7,9);
/*Table structure for table `django_content_type` */
DROP TABLE IF EXISTS `django_content_type`;
CREATE TABLE `django_content_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app_label` varchar(100) NOT NULL,
`model` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*Data for the table `django_content_type` */
insert into `django_content_type`(`id`,`app_label`,`model`) values
(1,'admin','logentry'),
(3,'auth','group'),
(2,'auth','permission'),
(4,'contenttypes','contenttype'),
(8,'home','article'),
(7,'home','articlecategory'),
(5,'sessions','session'),
(6,'users','user');
/*Table structure for table `django_migrations` */
DROP TABLE IF EXISTS `django_migrations`;
CREATE TABLE `django_migrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`applied` datetime(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
/*Data for the table `django_migrations` */
insert into `django_migrations`(`id`,`app`,`name`,`applied`) values
(1,'contenttypes','0001_initial','2021-12-28 10:15:41.583395'),
(2,'contenttypes','0002_remove_content_type_name','2021-12-28 10:15:41.760571'),
(3,'auth','0001_initial','2021-12-28 10:15:41.901141'),
(4,'auth','0002_alter_permission_name_max_length','2021-12-28 10:15:42.261178'),
(5,'auth','0003_alter_user_email_max_length','2021-12-28 10:15:42.273113'),
(6,'auth','0004_alter_user_username_opts','2021-12-28 10:15:42.289909'),
(7,'auth','0005_alter_user_last_login_null','2021-12-28 10:15:42.337799'),
(8,'auth','0006_require_contenttypes_0002','2021-12-28 10:15:42.345783'),
(9,'auth','0007_alter_validators_add_error_messages','2021-12-28 10:15:42.365728'),
(10,'auth','0008_alter_user_username_max_length','2021-12-28 10:15:42.386680'),
(11,'auth','0009_alter_user_last_name_max_length','2021-12-28 10:15:42.405617'),
(12,'auth','0010_alter_group_name_max_length','2021-12-28 10:15:42.512565'),
(13,'auth','0011_update_proxy_permissions','2021-12-28 10:15:42.531510'),
(14,'users','0001_initial','2021-12-28 10:15:42.650628'),
(15,'admin','0001_initial','2021-12-28 10:15:43.057862'),
(16,'admin','0002_logentry_remove_auto_add','2021-12-28 10:15:43.325015'),
(17,'admin','0003_logentry_add_action_flag_choices','2021-12-28 10:15:43.352935'),
(18,'sessions','0001_initial','2021-12-28 10:15:43.392858'),
(19,'home','0001_initial','2021-12-30 12:34:16.577719'),
(20,'home','0002_article','2021-12-31 06:39:20.509772');
/*Table structure for table `django_session` */
DROP TABLE IF EXISTS `django_session`;
CREATE TABLE `django_session` (
`session_key` varchar(40) NOT NULL,
`session_data` longtext NOT NULL,
`expire_date` datetime(6) NOT NULL,
PRIMARY KEY (`session_key`),
KEY `django_session_expire_date_a5c62663` (`expire_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `django_session` */
/*Table structure for table `tb_article` */
DROP TABLE IF EXISTS `tb_article`;
CREATE TABLE `tb_article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avatar` varchar(100) NOT NULL,
`tags` varchar(20) NOT NULL,
`title` varchar(100) NOT NULL,
`sumary` varchar(200) NOT NULL,
`content` longtext NOT NULL,
`total_views` int(10) unsigned NOT NULL,
`comments_count` int(10) unsigned NOT NULL,
`created` datetime(6) NOT NULL,
`updated` datetime(6) NOT NULL,
`author_id` int(11) NOT NULL,
`category_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tb_article_author_id_dcf763a4_fk_tb_user_id` (`author_id`),
KEY `tb_article_category_id_d66932e8_fk_tb_category_id` (`category_id`),
CONSTRAINT `tb_article_author_id_dcf763a4_fk_tb_user_id` FOREIGN KEY (`author_id`) REFERENCES `tb_user` (`id`),
CONSTRAINT `tb_article_category_id_d66932e8_fk_tb_category_id` FOREIGN KEY (`category_id`) REFERENCES `tb_category` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*Data for the table `tb_article` */
insert into `tb_article`(`id`,`avatar`,`tags`,`title`,`sumary`,`content`,`total_views`,`comments_count`,`created`,`updated`,`author_id`,`category_id`) values
(3,'article/20220101/wallhaven-l3m9lp.jpg','123','java','123','<p>123</p>\r\n',0,0,'2022-01-01 02:35:31.073201','2022-01-01 02:35:31.075194',9,2),
(4,'article/20220101/4.png','按钮','HTML','制作按钮流光特效','<p><strong>第一步</strong>给div设置宽高和圆角边框成一个圆角矩形。<br />\r\n<strong>第二步</strong>设置背景颜色为三种颜色的渐变色最后一个颜色需要和第一个颜色一样这样流动起来不会有卡颜色的情况并将背景大小设为400%</p>\r\n\r\n<p><strong>第三步</strong>:利用帧动画控制背景定位的横向移动。(@keyframes作用定义动画简单的动画可以直接使用关键字from和to复杂的利用0%~100%,分段设置相应的动画效果,即从一种状态过渡到另一种状态)</p>\r\n\r\n<p>再利用伪类hover实现鼠标移上去就出现动画的效果~</p>\r\n',0,0,'2022-01-01 03:22:21.431709','2022-01-01 03:22:21.433700',9,1),
(5,'article/20220101/5.png','django','django框架mysql数据库配置','mysql','<p>1.新建mysql数据库</p>\r\n\r\n<pre>\r\n<code>create database blog charset=utf8;</code></pre>\r\n\r\n<p>2.新建mysql用户</p>\r\n\r\n<pre>\r\n<code> create user gjj identified by &#39;123456&#39;;</code></pre>\r\n\r\n<p><code>3.授权gjj用户访问blog数据库</code></p>\r\n\r\n<p>4.授权结束后刷新特权</p>\r\n\r\n<pre>\r\n<code>$ flush privileges;</code></pre>\r\n\r\n<p><code>5.</code>配置MySQL数据库</p>\r\n\r\n<pre>\r\n<code>DATABASES = {\r\n &#39;default&#39;: {\r\n &#39;ENGINE&#39;: &#39;django.db.backends.mysql&#39;, # 数据库引擎\r\n &#39;HOST&#39;: &#39;127.0.0.1&#39;, # 数据库主机\r\n &#39;PORT&#39;: 3306, # 数据库端口\r\n &#39;USER&#39;: &#39;gjj&#39;, # 数据库用户名\r\n &#39;PASSWORD&#39;: &#39;123456&#39;, # 数据库用户密码\r\n &#39;NAME&#39;: &#39;blog&#39; # 数据库名字\r\n },\r\n}</code></pre>\r\n\r\n<p><code>6.</code>1.安装驱动程序</p>\r\n\r\n<pre>\r\n<code>pip install PyMySQL</code></pre>\r\n\r\n<p><code>7.</code>在工程同名子目录的<code>__init__.py</code>文件中,添加如下代码:</p>\r\n\r\n<pre>\r\n<code>import pymysql\r\npymysql.install_as_MySQLdb()</code></pre>\r\n\r\n<p>&nbsp;</p>\r\n',0,0,'2022-01-01 03:37:00.994256','2022-01-01 03:37:00.996252',9,1),
(6,'article/20220101/bizhi.jpg','django','界面展示','创建用户模块应用','<p>1.创建应用users</p>\r\n\r\n<pre>\r\n<code> python manage.py startapp users</code></pre>\r\n\r\n<p>2.注册用户模块应用</p>\r\n\r\n<pre>\r\n<code>INSTALLED_APPS = [\r\n ...\r\n\r\n &#39;users.apps.UsersConfig&#39;,\r\n]</code></pre>\r\n\r\n<p>3. 准备模板目录并设置模板路径</p>\r\n\r\n<p>4.定义用户登录视图</p>\r\n\r\n<pre>\r\n<code>from django.views import View\r\n\r\nclass LoginView(View):\r\n &quot;&quot;&quot;用户注册&quot;&quot;&quot;\r\n\r\n def get(self, request):\r\n &quot;&quot;&quot;\r\n 提供注册界面\r\n :param request: 请求对象\r\n :return: 注册界面\r\n &quot;&quot;&quot;\r\n return render(request, &#39;login.html&#39;)</code></pre>\r\n\r\n<p>5.定义用户注册路由</p>\r\n\r\n<p>在users子应用中创建urls.py文件并定义子路由</p>\r\n\r\n<pre>\r\n<code>from django.urls import path\r\nfrom users.views import LoginView\r\n\r\nurlpatterns = [\r\n # 参数1路由\r\n # 参数2视图函数\r\n # 参数3路由名方便通过reverse来获取路由\r\n path(&#39;login/&#39;,LoginView.as_view(),name=&#39;login&#39;),\r\n]</code></pre>\r\n\r\n<p>在工程的urls.py总路由中添加子应用路由引导</p>\r\n\r\n<pre>\r\n<code>from django.contrib import admin\r\nfrom django.urls import path,include\r\n\r\nurlpatterns = [\r\n path(&#39;admin/&#39;, admin.site.urls),\r\n # include 参数1要设置为元组urlconf_module, app_name\r\n # namespace 设置命名空间\r\n path(&#39;&#39;, include((&#39;users.urls&#39;, &#39;users&#39;), namespace=&#39;users&#39;)),\r\n]</code></pre>\r\n\r\n<p>6.修改静态文件加载方式</p>\r\n\r\n<pre>\r\n<code>{% load staticfiles %}</code></pre>\r\n\r\n<p>&nbsp;</p>\r\n',0,0,'2022-01-01 12:27:14.724573','2022-01-01 12:27:14.738272',9,1);
/*Table structure for table `tb_category` */
DROP TABLE IF EXISTS `tb_category`;
CREATE TABLE `tb_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`created` datetime(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
/*Data for the table `tb_category` */
insert into `tb_category`(`id`,`title`,`created`) values
(1,'Python','2021-12-31 05:41:00.000000'),
(2,'java','2021-12-31 05:41:00.000000'),
(11,'C','2021-12-31 14:35:00.000000'),
(12,'C++','2021-12-31 14:35:00.000000');
/*Table structure for table `tb_user` */
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`password` varchar(128) NOT NULL,
`last_login` datetime(6) DEFAULT NULL,
`is_superuser` tinyint(1) NOT NULL,
`username` varchar(150) NOT NULL,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(150) NOT NULL,
`email` varchar(254) NOT NULL,
`is_staff` tinyint(1) NOT NULL,
`is_active` tinyint(1) NOT NULL,
`date_joined` datetime(6) NOT NULL,
`mobile` varchar(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `mobile` (`mobile`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*Data for the table `tb_user` */
insert into `tb_user`(`id`,`password`,`last_login`,`is_superuser`,`username`,`first_name`,`last_name`,`email`,`is_staff`,`is_active`,`date_joined`,`mobile`) values
(8,'pbkdf2_sha256$120000$sOmJngfnDj5T$R0rjDrUhhDjgyvKeVZBkuXTLCIGeTCMzzmaDpXnxSyU=',NULL,0,'18368421420','','','',0,1,'2021-12-30 06:57:28.456386','18368421420'),
(9,'pbkdf2_sha256$120000$IDb44mCqB9UJ$oD44/AqGCAFOT70p+EDSGd1NnoSKn07BTmqGKlFb2Fk=','2022-01-01 12:18:02.448066',1,'17758012441','','','1357680054@qq.com',1,1,'2021-12-30 12:49:06.772659','17758012441'),
(10,'pbkdf2_sha256$120000$LWk647w6GYWA$0NwD2TZDcs2xcIIlXPbb+/XOUs+hCd8YjzL9fov7vzs=',NULL,0,'18368421421','','','',0,1,'2022-01-02 04:21:28.083901','18368421421');
/*Table structure for table `tb_user_groups` */
DROP TABLE IF EXISTS `tb_user_groups`;
CREATE TABLE `tb_user_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `tb_user_groups_user_id_group_id_adb62351_uniq` (`user_id`,`group_id`),
KEY `tb_user_groups_group_id_3d826fde_fk_auth_group_id` (`group_id`),
CONSTRAINT `tb_user_groups_group_id_3d826fde_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
CONSTRAINT `tb_user_groups_user_id_162ae03c_fk_tb_user_id` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `tb_user_groups` */
/*Table structure for table `tb_user_user_permissions` */
DROP TABLE IF EXISTS `tb_user_user_permissions`;
CREATE TABLE `tb_user_user_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `tb_user_user_permissions_user_id_permission_id_fb1d58db_uniq` (`user_id`,`permission_id`),
KEY `tb_user_user_permiss_permission_id_83890c0b_fk_auth_perm` (`permission_id`),
CONSTRAINT `tb_user_user_permiss_permission_id_83890c0b_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `tb_user_user_permissions_user_id_1b639637_fk_tb_user_id` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `tb_user_user_permissions` */
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;