| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784 |
- namespace WePlatform.Migrations
- {
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure.Annotations;
- using System.Data.Entity.Migrations;
- public partial class InitCreate : DbMigration
- {
- public override void Up()
- {
- CreateTable(
- "dbo.Sys_Permissions",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- Name = c.String(nullable: false, maxLength: 500),
- Master = c.Int(),
- MasterValue = c.String(maxLength: 100),
- Access = c.Int(),
- AccessValue = c.String(maxLength: 500),
- IsGranted = c.Boolean(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- UserId = c.Long(),
- Discriminator = c.String(nullable: false, maxLength: 128),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_DataPermission_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_PermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_RolePermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_UserPermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId);
- CreateTable(
- "dbo.Sys_Notifications",
- c => new
- {
- Id = c.Guid(nullable: false),
- NotificationName = c.String(nullable: false, maxLength: 96),
- Data = c.String(),
- DataTypeName = c.String(maxLength: 512),
- EntityTypeName = c.String(maxLength: 250),
- EntityTypeAssemblyQualifiedName = c.String(maxLength: 512),
- EntityId = c.String(maxLength: 96),
- Severity = c.Byte(nullable: false),
- UserIds = c.String(),
- ExcludedUserIds = c.String(),
- TenantIds = c.String(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- })
- .PrimaryKey(t => t.Id);
- CreateTable(
- "dbo.Sys_NotificationSubscriptions",
- c => new
- {
- Id = c.Guid(nullable: false),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- NotificationName = c.String(maxLength: 96),
- EntityTypeName = c.String(maxLength: 250),
- EntityTypeAssemblyQualifiedName = c.String(maxLength: 512),
- EntityId = c.String(maxLength: 96),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_NotificationSubscriptionInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId)
- .Index(t => new { t.NotificationName, t.EntityTypeName, t.EntityId, t.UserId });
- CreateTable(
- "dbo.Sys_Roles",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- Description = c.String(),
- NormalizedName = c.String(nullable: false, maxLength: 32),
- ConcurrencyStamp = c.String(maxLength: 128),
- TenantId = c.Int(),
- Name = c.String(nullable: false, maxLength: 32),
- RoleType = c.Int(nullable: false),
- AccountType = c.Int(),
- DisplayName = c.String(nullable: false, maxLength: 64),
- IsStatic = c.Boolean(nullable: false),
- IsDefault = c.Boolean(nullable: false),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_Role_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_Role_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.TenantId)
- .Index(t => t.Name)
- .Index(t => t.RoleType)
- .Index(t => t.AccountType)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_RoleClaims",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- RoleId = c.Int(nullable: false),
- ClaimType = c.String(maxLength: 256),
- ClaimValue = c.String(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_RoleClaim_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Roles", t => t.RoleId, cascadeDelete: true)
- .Index(t => t.TenantId)
- .Index(t => t.RoleId);
- CreateTable(
- "dbo.Sys_Users",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- NormalizedUserName = c.String(nullable: false, maxLength: 256),
- NormalizedEmailAddress = c.String(nullable: false, maxLength: 256),
- ConcurrencyStamp = c.String(maxLength: 128),
- AuthenticationSource = c.String(maxLength: 64),
- UserName = c.String(nullable: false, maxLength: 256),
- UserType = c.Int(nullable: false),
- AccountType = c.Int(),
- AccountNo = c.String(maxLength: 100),
- ImagePath = c.String(maxLength: 1000),
- TenantId = c.Int(),
- EmailAddress = c.String(nullable: false, maxLength: 256),
- Name = c.String(nullable: false, maxLength: 64),
- Surname = c.String(maxLength: 64),
- AvatarImagePath = c.String(maxLength: 500),
- Password = c.String(nullable: false, maxLength: 128),
- EmailConfirmationCode = c.String(maxLength: 328),
- PasswordResetCode = c.String(maxLength: 328),
- LockoutEndDateUtc = c.DateTime(),
- AccessFailedCount = c.Int(nullable: false),
- IsLockoutEnabled = c.Boolean(nullable: false),
- PhoneNumber = c.String(maxLength: 32),
- IsPhoneNumberConfirmed = c.Boolean(nullable: false),
- SecurityStamp = c.String(maxLength: 128),
- IsTwoFactorEnabled = c.Boolean(nullable: false),
- IsEmailConfirmed = c.Boolean(nullable: false),
- IsActive = c.Boolean(nullable: false),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_User_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_User_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.UserName)
- .Index(t => t.UserType)
- .Index(t => t.AccountType)
- .Index(t => t.TenantId)
- .Index(t => t.EmailAddress)
- .Index(t => t.PhoneNumber)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_UserClaims",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- ClaimType = c.String(maxLength: 256),
- ClaimValue = c.String(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserClaim_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.UserId, cascadeDelete: true)
- .Index(t => t.TenantId)
- .Index(t => t.UserId);
- CreateTable(
- "dbo.Sys_UserLogins",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- LoginProvider = c.String(nullable: false, maxLength: 128),
- ProviderKey = c.String(nullable: false, maxLength: 256),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserLogin_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.UserId, cascadeDelete: true)
- .Index(t => t.TenantId)
- .Index(t => t.UserId);
- CreateTable(
- "dbo.Sys_UserRoles",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- RoleId = c.Int(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserRole_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.UserId, cascadeDelete: true)
- .Index(t => t.TenantId)
- .Index(t => t.UserId);
- CreateTable(
- "dbo.Sys_Settings",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- UserId = c.Long(),
- Name = c.String(nullable: false, maxLength: 256),
- Value = c.String(),
- DisplayName = c.String(maxLength: 50),
- Type = c.Int(),
- Description = c.String(maxLength: 500),
- Remark = c.String(maxLength: 500),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.UserId)
- .Index(t => new { t.TenantId, t.Name, t.UserId }, unique: true);
- CreateTable(
- "dbo.Sys_AppGuids",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- Step = c.Short(nullable: false),
- LastId = c.Int(nullable: false),
- IdType = c.Short(nullable: false),
- LastUseDate = c.DateTime(),
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.IdType);
- CreateTable(
- "dbo.Sys_AttachFiles",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- AttachNo = c.String(maxLength: 32),
- TableName = c.String(maxLength: 50),
- ColumnName = c.String(maxLength: 50),
- SourceKey = c.String(maxLength: 50),
- FileTitle = c.String(maxLength: 50),
- FileName = c.String(maxLength: 50),
- FilePath = c.String(maxLength: 500),
- FileType = c.String(maxLength: 20),
- FileExt = c.String(maxLength: 10),
- Description = c.String(maxLength: 500),
- TenantId = c.Int(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysAttachFile_MustHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .Index(t => t.TenantId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_Functions",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- FunctionNo = c.String(maxLength: 100),
- ParentNo = c.String(maxLength: 100),
- FunctionName = c.String(maxLength: 100),
- PermissionName = c.String(maxLength: 500),
- FunctionType = c.Int(nullable: false),
- Action = c.String(maxLength: 50),
- Controller = c.String(maxLength: 50),
- Url = c.String(),
- Icon = c.String(maxLength: 20),
- Class = c.String(maxLength: 100),
- Script = c.String(),
- NeedAuth = c.Boolean(nullable: false),
- Sort = c.Int(nullable: false),
- Depth = c.Int(nullable: false),
- IsLeaf = c.Boolean(),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysFunction_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.FunctionNo)
- .Index(t => t.PermissionName, unique: true)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_SysHelps",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- Classification = c.String(maxLength: 40),
- HelpTitle = c.String(nullable: false, maxLength: 50),
- HelpKeyWords = c.String(maxLength: 50),
- HelpContent = c.String(),
- FunctionNo = c.String(maxLength: 100),
- PermissionName = c.String(maxLength: 500),
- Sequence = c.Int(nullable: false),
- Description = c.String(),
- Remark = c.String(maxLength: 1000),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysHelp_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_AuditLogs",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(nullable: false),
- UserId = c.Long(),
- UserName = c.String(),
- ServiceName = c.String(maxLength: 256),
- ServiceNameLang = c.String(),
- MethodName = c.String(maxLength: 256),
- MethodNameLang = c.String(),
- Parameters = c.String(maxLength: 1024),
- ExecutionTime = c.DateTime(nullable: false),
- ExecutionDuration = c.Int(nullable: false),
- ClientIpAddress = c.String(maxLength: 64),
- ClientName = c.String(maxLength: 128),
- BrowserInfo = c.String(maxLength: 512),
- Exception = c.String(maxLength: 2000),
- ImpersonatorUserId = c.Long(),
- ImpersonatorTenantId = c.Int(),
- CustomData = c.String(maxLength: 2000),
- LogType = c.Int(nullable: false),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysLog_MustHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId)
- .Index(t => t.UserId);
- CreateTable(
- "dbo.Sys_States",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- StateNo = c.String(maxLength: 32),
- StateName = c.String(maxLength: 50),
- TableName = c.String(nullable: false, maxLength: 50),
- ColumnName = c.String(nullable: false, maxLength: 50),
- CodeValue = c.String(nullable: false, maxLength: 100),
- DisplayValue = c.String(nullable: false, maxLength: 100),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysState_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_NotificationTenants",
- c => new
- {
- Id = c.Guid(nullable: false),
- TenantId = c.Int(),
- NotificationName = c.String(nullable: false, maxLength: 96),
- Data = c.String(),
- DataTypeName = c.String(maxLength: 512),
- EntityTypeName = c.String(maxLength: 250),
- EntityTypeAssemblyQualifiedName = c.String(maxLength: 512),
- EntityId = c.String(maxLength: 96),
- Severity = c.Byte(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_TenantNotificationInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId);
- CreateTable(
- "dbo.Sys_Tenants",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- TenancyName = c.String(nullable: false, maxLength: 64),
- Name = c.String(nullable: false, maxLength: 128),
- ConnectionString = c.String(maxLength: 1024),
- IsActive = c.Boolean(nullable: false),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_Tenant_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
- CreateTable(
- "dbo.Sys_UserAccounts",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- UserLinkId = c.Long(),
- UserName = c.String(maxLength: 256),
- EmailAddress = c.String(maxLength: 256),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserAccount_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.IsDeleted);
- CreateTable(
- "dbo.Sys_UserLoginAttempts",
- c => new
- {
- Id = c.Long(nullable: false, identity: true),
- TenantId = c.Int(),
- TenancyName = c.String(maxLength: 64),
- UserId = c.Long(),
- UserNameOrEmailAddress = c.String(maxLength: 255),
- ClientIpAddress = c.String(maxLength: 64),
- ClientName = c.String(maxLength: 128),
- BrowserInfo = c.String(maxLength: 512),
- Result = c.Byte(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserLoginAttempt_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId)
- .Index(t => new { t.UserId, t.TenantId })
- .Index(t => new { t.TenancyName, t.UserNameOrEmailAddress, t.Result });
- CreateTable(
- "dbo.Sys_NotificationUsers",
- c => new
- {
- Id = c.Guid(nullable: false),
- TenantId = c.Int(),
- UserId = c.Long(nullable: false),
- TenantNotificationId = c.Guid(nullable: false),
- State = c.Int(nullable: false),
- CreationTime = c.DateTime(nullable: false),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserNotificationInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .Index(t => t.TenantId)
- .Index(t => new { t.UserId, t.State, t.CreationTime });
- }
- public override void Down()
- {
- DropForeignKey("dbo.Sys_Tenants", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Tenants", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Tenants", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_States", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_States", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_States", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_SysHelps", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_SysHelps", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_SysHelps", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Functions", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Functions", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Functions", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_AttachFiles", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Roles", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Roles", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Roles", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Settings", "UserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Users", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Users", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_Users", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users");
- DropForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles");
- DropIndex("dbo.Sys_NotificationUsers", new[] { "UserId", "State", "CreationTime" });
- DropIndex("dbo.Sys_NotificationUsers", new[] { "TenantId" });
- DropIndex("dbo.Sys_UserLoginAttempts", new[] { "TenancyName", "UserNameOrEmailAddress", "Result" });
- DropIndex("dbo.Sys_UserLoginAttempts", new[] { "UserId", "TenantId" });
- DropIndex("dbo.Sys_UserLoginAttempts", new[] { "TenantId" });
- DropIndex("dbo.Sys_UserAccounts", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_Tenants", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_Tenants", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_Tenants", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_Tenants", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_NotificationTenants", new[] { "TenantId" });
- DropIndex("dbo.Sys_States", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_States", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_States", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_States", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_AuditLogs", new[] { "UserId" });
- DropIndex("dbo.Sys_AuditLogs", new[] { "TenantId" });
- DropIndex("dbo.Sys_SysHelps", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_SysHelps", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_SysHelps", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_SysHelps", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_Functions", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_Functions", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_Functions", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_Functions", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_Functions", new[] { "PermissionName" });
- DropIndex("dbo.Sys_Functions", new[] { "FunctionNo" });
- DropIndex("dbo.Sys_AttachFiles", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_AttachFiles", new[] { "TenantId" });
- DropIndex("dbo.Sys_AppGuids", new[] { "IdType" });
- DropIndex("dbo.Sys_Settings", new[] { "TenantId", "Name", "UserId" });
- DropIndex("dbo.Sys_UserRoles", new[] { "UserId" });
- DropIndex("dbo.Sys_UserRoles", new[] { "TenantId" });
- DropIndex("dbo.Sys_UserLogins", new[] { "UserId" });
- DropIndex("dbo.Sys_UserLogins", new[] { "TenantId" });
- DropIndex("dbo.Sys_UserClaims", new[] { "UserId" });
- DropIndex("dbo.Sys_UserClaims", new[] { "TenantId" });
- DropIndex("dbo.Sys_Users", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_Users", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_Users", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_Users", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_Users", new[] { "PhoneNumber" });
- DropIndex("dbo.Sys_Users", new[] { "EmailAddress" });
- DropIndex("dbo.Sys_Users", new[] { "TenantId" });
- DropIndex("dbo.Sys_Users", new[] { "AccountType" });
- DropIndex("dbo.Sys_Users", new[] { "UserType" });
- DropIndex("dbo.Sys_Users", new[] { "UserName" });
- DropIndex("dbo.Sys_RoleClaims", new[] { "RoleId" });
- DropIndex("dbo.Sys_RoleClaims", new[] { "TenantId" });
- DropIndex("dbo.Sys_Roles", new[] { "CreatorUserId" });
- DropIndex("dbo.Sys_Roles", new[] { "LastModifierUserId" });
- DropIndex("dbo.Sys_Roles", new[] { "DeleterUserId" });
- DropIndex("dbo.Sys_Roles", new[] { "IsDeleted" });
- DropIndex("dbo.Sys_Roles", new[] { "AccountType" });
- DropIndex("dbo.Sys_Roles", new[] { "RoleType" });
- DropIndex("dbo.Sys_Roles", new[] { "Name" });
- DropIndex("dbo.Sys_Roles", new[] { "TenantId" });
- DropIndex("dbo.Sys_NotificationSubscriptions", new[] { "NotificationName", "EntityTypeName", "EntityId", "UserId" });
- DropIndex("dbo.Sys_NotificationSubscriptions", new[] { "TenantId" });
- DropIndex("dbo.Sys_Permissions", new[] { "TenantId" });
- DropTable("dbo.Sys_NotificationUsers",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserNotificationInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_UserLoginAttempts",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserLoginAttempt_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_UserAccounts",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserAccount_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_Tenants",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_Tenant_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_NotificationTenants",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_TenantNotificationInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_States",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysState_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_AuditLogs",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysLog_MustHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_SysHelps",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysHelp_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_Functions",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysFunction_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_AttachFiles",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysAttachFile_MustHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_AppGuids");
- DropTable("dbo.Sys_Settings",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_SysSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_UserRoles",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserRole_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_UserLogins",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserLogin_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_UserClaims",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_UserClaim_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_Users",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_User_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_User_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_RoleClaims",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_RoleClaim_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_Roles",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_Role_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_Role_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_NotificationSubscriptions",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_NotificationSubscriptionInfo_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.Sys_Notifications");
- DropTable("dbo.Sys_Permissions",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_DataPermission_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_PermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_RolePermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- { "DynamicFilter_UserPermissionSetting_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- }
- }
- }
|