namespace Sevomin.Models.Migrations
|
|
{
|
|
using System;
|
|
using System.Data.Entity.Migrations;
|
|
|
|
public partial class Init : DbMigration
|
|
{
|
|
public override void Up()
|
|
{
|
|
CreateTable(
|
|
"dbo.Ads",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
Title = c.String(),
|
|
Description = c.String(),
|
|
Duration = c.Int(nullable: false),
|
|
ClickCount = c.Long(nullable: false),
|
|
Link = c.String(),
|
|
CreatedDate = c.DateTime(nullable: false),
|
|
Active = c.Boolean(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id);
|
|
|
|
CreateTable(
|
|
"dbo.DovominJobs",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
DovominId = c.String(nullable: false, maxLength: 128),
|
|
JobId = c.Long(nullable: false),
|
|
ApplyDate = c.DateTime(nullable: false),
|
|
CoverLetter = c.String(),
|
|
Affinity = c.Decimal(nullable: false, precision: 18, scale: 2),
|
|
MinimumRequirement = c.Boolean(nullable: false),
|
|
AvalinSeen = c.DateTime(),
|
|
AvalinComment = c.String(),
|
|
AvalinDelete = c.Boolean(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.Dovomin", t => t.DovominId)
|
|
.ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
|
|
.Index(t => new { t.DovominId, t.JobId }, unique: true, name: "IX_DovominJobUniqueIndex")
|
|
.Index(t => t.JobId);
|
|
|
|
CreateTable(
|
|
"dbo.AspNetUsers",
|
|
c => new
|
|
{
|
|
Id = c.String(nullable: false, maxLength: 128),
|
|
DisplayName = c.String(),
|
|
SignUpDate = c.DateTime(nullable: false),
|
|
ConfirmationCode = c.String(),
|
|
Email = c.String(maxLength: 256),
|
|
EmailConfirmed = c.Boolean(nullable: false),
|
|
PasswordHash = c.String(),
|
|
SecurityStamp = c.String(),
|
|
PhoneNumber = c.String(),
|
|
PhoneNumberConfirmed = c.Boolean(nullable: false),
|
|
TwoFactorEnabled = c.Boolean(nullable: false),
|
|
LockoutEndDateUtc = c.DateTime(),
|
|
LockoutEnabled = c.Boolean(nullable: false),
|
|
AccessFailedCount = c.Int(nullable: false),
|
|
UserName = c.String(nullable: false, maxLength: 256),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.Index(t => t.UserName, unique: true, name: "UserNameIndex");
|
|
|
|
CreateTable(
|
|
"dbo.AspNetUserClaims",
|
|
c => new
|
|
{
|
|
Id = c.Int(nullable: false, identity: true),
|
|
UserId = c.String(nullable: false, maxLength: 128),
|
|
ClaimType = c.String(),
|
|
ClaimValue = c.String(),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
|
.Index(t => t.UserId);
|
|
|
|
CreateTable(
|
|
"dbo.DovominParameters",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
ParameterId = c.Long(nullable: false),
|
|
DovominId = c.String(nullable: false, maxLength: 128),
|
|
StringValue = c.String(),
|
|
NumericValue = c.Decimal(precision: 18, scale: 2),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.Dovomin", t => t.DovominId)
|
|
.ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
|
|
.Index(t => new { t.ParameterId, t.DovominId }, unique: true, name: "IX_DovominParameterUniqueIndex")
|
|
.Index(t => t.DovominId);
|
|
|
|
CreateTable(
|
|
"dbo.Parameters",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
Name = c.String(nullable: false),
|
|
Moscow = c.Boolean(nullable: false),
|
|
DisplayMethod = c.Byte(nullable: false),
|
|
DisplayFormat = c.String(maxLength: 50),
|
|
GroupName = c.String(nullable: false),
|
|
CommentAvalin = c.String(maxLength: 140),
|
|
CommentDovomin = c.String(maxLength: 140),
|
|
ParameterValueId = c.String(maxLength: 50),
|
|
BasePoint = c.Int(nullable: false),
|
|
ParameterType = c.Int(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id);
|
|
|
|
CreateTable(
|
|
"dbo.JobParameters",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
ParameterId = c.Long(nullable: false),
|
|
JobId = c.Long(nullable: false),
|
|
StringValue = c.String(),
|
|
NumericValue = c.Decimal(precision: 18, scale: 2),
|
|
Moscow = c.Byte(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
|
|
.ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
|
|
.Index(t => new { t.ParameterId, t.JobId }, unique: true, name: "IX_JobParameterUniqueIndex")
|
|
.Index(t => t.JobId);
|
|
|
|
CreateTable(
|
|
"dbo.Jobs",
|
|
c => new
|
|
{
|
|
Id = c.Long(nullable: false, identity: true),
|
|
AvalinId = c.String(nullable: false, maxLength: 128),
|
|
CreateDate = c.DateTime(nullable: false),
|
|
ExpireDate = c.DateTime(nullable: false),
|
|
Description = c.String(),
|
|
ResumeType = c.Byte(nullable: false),
|
|
ContactPersonName = c.String(),
|
|
ContactPersonPhone = c.String(),
|
|
ContactPersonEMail = c.String(),
|
|
ShowCompanyName = c.Boolean(nullable: false),
|
|
ShowCompanyLogo = c.Boolean(nullable: false),
|
|
IsFullTime = c.Boolean(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.Avalin", t => t.AvalinId)
|
|
.Index(t => t.AvalinId);
|
|
|
|
CreateTable(
|
|
"dbo.AspNetUserLogins",
|
|
c => new
|
|
{
|
|
LoginProvider = c.String(nullable: false, maxLength: 128),
|
|
ProviderKey = c.String(nullable: false, maxLength: 128),
|
|
UserId = c.String(nullable: false, maxLength: 128),
|
|
})
|
|
.PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
|
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
|
.Index(t => t.UserId);
|
|
|
|
CreateTable(
|
|
"dbo.AspNetUserRoles",
|
|
c => new
|
|
{
|
|
UserId = c.String(nullable: false, maxLength: 128),
|
|
RoleId = c.String(nullable: false, maxLength: 128),
|
|
})
|
|
.PrimaryKey(t => new { t.UserId, t.RoleId })
|
|
.ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
|
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
|
.Index(t => t.UserId)
|
|
.Index(t => t.RoleId);
|
|
|
|
CreateTable(
|
|
"dbo.ParameterValues",
|
|
c => new
|
|
{
|
|
GroupKey = c.String(nullable: false, maxLength: 50),
|
|
Value = c.String(nullable: false, maxLength: 50),
|
|
NumbericValue = c.Decimal(nullable: false, precision: 18, scale: 2),
|
|
})
|
|
.PrimaryKey(t => new { t.GroupKey, t.Value })
|
|
.Index(t => t.GroupKey);
|
|
|
|
CreateTable(
|
|
"dbo.AspNetRoles",
|
|
c => new
|
|
{
|
|
Id = c.String(nullable: false, maxLength: 128),
|
|
Name = c.String(nullable: false, maxLength: 256),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.Index(t => t.Name, unique: true, name: "RoleNameIndex");
|
|
|
|
CreateTable(
|
|
"dbo.Dovomin",
|
|
c => new
|
|
{
|
|
Id = c.String(nullable: false, maxLength: 128),
|
|
FirstName = c.String(),
|
|
LastName = c.String(),
|
|
BirthDate = c.DateTime(),
|
|
IsFulltime = c.Boolean(nullable: false),
|
|
IsPartTime = c.Boolean(nullable: false),
|
|
Description = c.String(),
|
|
EnglishResume = c.String(),
|
|
PersianResume = c.String(),
|
|
OptOutEmail = c.Boolean(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.AspNetUsers", t => t.Id)
|
|
.Index(t => t.Id);
|
|
|
|
CreateTable(
|
|
"dbo.Avalin",
|
|
c => new
|
|
{
|
|
Id = c.String(nullable: false, maxLength: 128),
|
|
CompanyName = c.String(nullable: false),
|
|
NationalId = c.String(maxLength: 12),
|
|
RegisterId = c.String(maxLength: 10),
|
|
Address = c.String(),
|
|
CompanyPhoneNumber = c.String(),
|
|
EMail = c.String(),
|
|
})
|
|
.PrimaryKey(t => t.Id)
|
|
.ForeignKey("dbo.AspNetUsers", t => t.Id)
|
|
.Index(t => t.Id);
|
|
|
|
}
|
|
|
|
public override void Down()
|
|
{
|
|
DropForeignKey("dbo.Avalin", "Id", "dbo.AspNetUsers");
|
|
DropForeignKey("dbo.Dovomin", "Id", "dbo.AspNetUsers");
|
|
DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
|
|
DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
|
|
DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
|
|
DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
|
|
DropForeignKey("dbo.JobParameters", "ParameterId", "dbo.Parameters");
|
|
DropForeignKey("dbo.JobParameters", "JobId", "dbo.Jobs");
|
|
DropForeignKey("dbo.Jobs", "AvalinId", "dbo.Avalin");
|
|
DropForeignKey("dbo.DovominJobs", "JobId", "dbo.Jobs");
|
|
DropForeignKey("dbo.DovominParameters", "ParameterId", "dbo.Parameters");
|
|
DropForeignKey("dbo.DovominParameters", "DovominId", "dbo.Dovomin");
|
|
DropForeignKey("dbo.DovominJobs", "DovominId", "dbo.Dovomin");
|
|
DropIndex("dbo.Avalin", new[] { "Id" });
|
|
DropIndex("dbo.Dovomin", new[] { "Id" });
|
|
DropIndex("dbo.AspNetRoles", "RoleNameIndex");
|
|
DropIndex("dbo.ParameterValues", new[] { "GroupKey" });
|
|
DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
|
|
DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
|
|
DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
|
|
DropIndex("dbo.Jobs", new[] { "AvalinId" });
|
|
DropIndex("dbo.JobParameters", new[] { "JobId" });
|
|
DropIndex("dbo.JobParameters", "IX_JobParameterUniqueIndex");
|
|
DropIndex("dbo.DovominParameters", new[] { "DovominId" });
|
|
DropIndex("dbo.DovominParameters", "IX_DovominParameterUniqueIndex");
|
|
DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
|
|
DropIndex("dbo.AspNetUsers", "UserNameIndex");
|
|
DropIndex("dbo.DovominJobs", new[] { "JobId" });
|
|
DropIndex("dbo.DovominJobs", "IX_DovominJobUniqueIndex");
|
|
DropTable("dbo.Avalin");
|
|
DropTable("dbo.Dovomin");
|
|
DropTable("dbo.AspNetRoles");
|
|
DropTable("dbo.ParameterValues");
|
|
DropTable("dbo.AspNetUserRoles");
|
|
DropTable("dbo.AspNetUserLogins");
|
|
DropTable("dbo.Jobs");
|
|
DropTable("dbo.JobParameters");
|
|
DropTable("dbo.Parameters");
|
|
DropTable("dbo.DovominParameters");
|
|
DropTable("dbo.AspNetUserClaims");
|
|
DropTable("dbo.AspNetUsers");
|
|
DropTable("dbo.DovominJobs");
|
|
DropTable("dbo.Ads");
|
|
}
|
|
}
|
|
}
|