sql 用于mysql的asp.net标识

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 用于mysql的asp.net标识相关的知识,希望对你有一定的参考价值。

CREATE DATABASE `AspNetIdentity` /*!40100 DEFAULT CHARACTER SET utf8 */;

CREATE TABLE `AspNetRole` (
  `Id` varchar(128) NOT NULL,
  `Name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `Name_UNIQUE` (`Name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `AspNetUser` (
  `Id` varchar(128) NOT NULL,
  `UserName` varchar(255) NOT NULL,
  `Email` varchar(256) DEFAULT NULL,
  `EmailConfirmed` bit(1) NOT NULL DEFAULT b'0',
  `PasswordHash` varchar(256) DEFAULT NULL,
  `SecurityStamp` varchar(256) DEFAULT NULL,
  `PhoneNumber` varchar(128) DEFAULT NULL,
  `PhoneNumberConfirmed` bit(1) NOT NULL DEFAULT b'0',
  `TwoFactorEnabled` bit(1) NOT NULL DEFAULT b'0',
  `LockoutEndDateUtc` datetime DEFAULT NULL,
  `LockoutEnabled` bit(1) NOT NULL DEFAULT b'0',
  `AccessFailedCount` int(11) DEFAULT '0',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `UserName_UNIQUE` (`UserName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `AspNetUserClaim` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `UserId` varchar(128) NOT NULL,
  `ClaimType` varchar(4000) DEFAULT NULL,
  `ClaimValue` varchar(4000) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_Claim_User_idx` (`UserId`),
  CONSTRAINT `FK_Claim_User` FOREIGN KEY (`UserId`) REFERENCES `AspNetUser` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `AspNetUserLogin` (
  `LoginProvider` varchar(128) NOT NULL,
  `ProviderKey` varchar(128) NOT NULL,
  `UserId` varchar(128) NOT NULL,
  PRIMARY KEY (`LoginProvider`,`ProviderKey`,`UserId`),
  KEY `FK_Login_User_idx` (`UserId`),
  CONSTRAINT `FK_Login_User` FOREIGN KEY (`UserId`) REFERENCES `AspNetUser` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `AspNetUserRole` (
  `UserId` varchar(128) NOT NULL,
  `RoleId` varchar(128) NOT NULL,
  PRIMARY KEY (`UserId`,`RoleId`),
  KEY `FK_RoleId_idx` (`RoleId`),
  CONSTRAINT `FK_RoleId` FOREIGN KEY (`RoleId`) REFERENCES `AspNetRole` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUser` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `ApplicationRole` (
  `RoleId` varchar(128) NOT NULL,
  `Description` varchar(256) NOT NULL,
  PRIMARY KEY (`RoleId`),
  CONSTRAINT `FK_ApplicationRole_AspNetRole` FOREIGN KEY (`RoleId`) REFERENCES `AspNetRole` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `ApplicationUser` (
  `UserId` varchar(128) NOT NULL,
  PRIMARY KEY (`UserId`),
  CONSTRAINT `FK_ApplicationUser_AspNetUser` FOREIGN KEY (`UserId`) REFERENCES `AspNetUser` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

以上是关于sql 用于mysql的asp.net标识的主要内容,如果未能解决你的问题,请参考以下文章

注销功能不适用于 ASP.NET 标识

注销功能不适用于 ASP.NET 标识

ASP.NET 标识 2 到 3

sQL数据库表的主键列设为标识,增量为1,下次插入数据时能不插入主键列吗

ASP.NET中GUID

asp.net中的ORA-12154: TNS: 无法解析指定的连接标识符