yavsc/Yavsc/Migrations/20160315144017_init.cs

415 lines
19 KiB
C#

using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
NormalizedName = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRole", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Location",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Address = table.Column<string>(nullable: false),
Latitude = table.Column<double>(nullable: false),
Longitude = table.Column<double>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Location", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AccountHistory",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountHistory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Activity",
columns: table => new
{
Code = table.Column<string>(nullable: false),
Description = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: false),
Photo = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Activity", x => x.Code);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(nullable: true),
NormalizedUserName = table.Column<string>(nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationUser", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Circle",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Name = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Circle", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Skill",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Name = table.Column<string>(nullable: true),
Rate = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skill", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRoleClaim<string>", x => x.Id);
table.ForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserClaim<string>", x => x.Id);
table.ForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserLogin<string>", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserRole<string>", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AccountBalance",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
Credits = table.Column<long>(nullable: false),
HistoryId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountBalance", x => x.UserId);
table.ForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
column: x => x.HistoryId,
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Blog",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
AuthorId = table.Column<string>(nullable: false),
bcontent = table.Column<string>(nullable: true),
modified = table.Column<DateTime>(nullable: false),
photo = table.Column<string>(nullable: true),
posted = table.Column<DateTime>(nullable: false),
rate = table.Column<int>(nullable: false),
title = table.Column<string>(nullable: true),
visible = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Blog", x => x.Id);
table.ForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
column: x => x.AuthorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SimpleBookQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
ValidationDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SimpleBookQuery", x => x.Id);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SimpleBookQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Command",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
ValidationDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Command", x => x.Id);
table.ForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PerformerProfile",
columns: table => new
{
PerfomerId = table.Column<string>(nullable: false),
AcceptGeoLocalisation = table.Column<bool>(nullable: false),
AcceptNotifications = table.Column<bool>(nullable: false),
AcceptPublicContact = table.Column<bool>(nullable: false),
Active = table.Column<bool>(nullable: false),
ActivityCode = table.Column<string>(nullable: false),
DailyCost = table.Column<int>(nullable: false),
Rate = table.Column<int>(nullable: false),
WebSite = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PerformerProfile", x => x.PerfomerId);
table.ForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
column: x => x.PerfomerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CircleMember",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
CircleId = table.Column<long>(nullable: false),
MemberId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CircleMember", x => x.Id);
table.ForeignKey(
name: "FK_CircleMember_Circle_CircleId",
column: x => x.CircleId,
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
column: x => x.MemberId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Estimate",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
CommandId = table.Column<long>(nullable: true),
Description = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: true),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Estimate", x => x.Id);
table.ForeignKey(
name: "FK_Estimate_Command_CommandId",
column: x => x.CommandId,
principalTable: "Command",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("AspNetRoleClaims");
migrationBuilder.DropTable("AspNetUserClaims");
migrationBuilder.DropTable("AspNetUserLogins");
migrationBuilder.DropTable("AspNetUserRoles");
migrationBuilder.DropTable("AccountBalance");
migrationBuilder.DropTable("Blog");
migrationBuilder.DropTable("SimpleBookQuery");
migrationBuilder.DropTable("CircleMember");
migrationBuilder.DropTable("Estimate");
migrationBuilder.DropTable("PerformerProfile");
migrationBuilder.DropTable("Skill");
migrationBuilder.DropTable("AspNetRoles");
migrationBuilder.DropTable("AccountHistory");
migrationBuilder.DropTable("Location");
migrationBuilder.DropTable("Circle");
migrationBuilder.DropTable("Command");
migrationBuilder.DropTable("Activity");
migrationBuilder.DropTable("AspNetUsers");
}
}
}