123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
- #nullable disable
- #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
- namespace OnlineMetodist.API.Migrations
- {
- /// <inheritdoc />
- public partial class InitWithIdentity : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AspNetRoles",
- columns: table => new
- {
- Id = table.Column<string>(type: "text", nullable: false),
- Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoles", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUsers",
- columns: table => new
- {
- Id = table.Column<string>(type: "text", nullable: false),
- UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
- PasswordHash = table.Column<string>(type: "text", nullable: true),
- SecurityStamp = table.Column<string>(type: "text", nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
- PhoneNumber = table.Column<string>(type: "text", nullable: true),
- PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
- TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
- LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
- AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUsers", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "FormsOfWorks",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "text", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_FormsOfWorks", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "AspNetRoleClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- RoleId = table.Column<string>(type: "text", nullable: false),
- ClaimType = table.Column<string>(type: "text", nullable: true),
- ClaimValue = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- UserId = table.Column<string>(type: "text", nullable: false),
- ClaimType = table.Column<string>(type: "text", nullable: true),
- ClaimValue = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUserClaims_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserLogins",
- columns: table => new
- {
- LoginProvider = table.Column<string>(type: "text", nullable: false),
- ProviderKey = table.Column<string>(type: "text", nullable: false),
- ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
- UserId = table.Column<string>(type: "text", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
- table.ForeignKey(
- name: "FK_AspNetUserLogins_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserRoles",
- columns: table => new
- {
- UserId = table.Column<string>(type: "text", nullable: false),
- RoleId = table.Column<string>(type: "text", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserTokens",
- columns: table => new
- {
- UserId = table.Column<string>(type: "text", nullable: false),
- LoginProvider = table.Column<string>(type: "text", nullable: false),
- Name = table.Column<string>(type: "text", nullable: false),
- Value = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
- table.ForeignKey(
- name: "FK_AspNetUserTokens_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Employees",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Surname = table.Column<string>(type: "text", nullable: false),
- Name = table.Column<string>(type: "text", nullable: false),
- Patronymic = table.Column<string>(type: "text", nullable: true),
- UserId = table.Column<string>(type: "text", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Employees", x => x.Id);
- table.ForeignKey(
- name: "FK_Employees_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Events",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- DateOfEvent = table.Column<DateOnly>(type: "date", nullable: false),
- EndDateOfEvent = table.Column<DateOnly>(type: "date", nullable: true),
- Specifications = table.Column<string>(type: "text", nullable: false),
- IdFormOfWork = table.Column<Guid>(type: "uuid", nullable: false),
- FormOfWorkFKId = table.Column<Guid>(type: "uuid", nullable: false),
- EmployeeId = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Events", x => x.Id);
- table.ForeignKey(
- name: "FK_Events_Employees_EmployeeId",
- column: x => x.EmployeeId,
- principalTable: "Employees",
- principalColumn: "Id");
- table.ForeignKey(
- name: "FK_Events_FormsOfWorks_FormOfWorkFKId",
- column: x => x.FormOfWorkFKId,
- principalTable: "FormsOfWorks",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "MethodicaCommissions",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "text", nullable: false),
- IdHead = table.Column<Guid>(type: "uuid", nullable: true),
- HeadMCId = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_MethodicaCommissions", x => x.Id);
- table.ForeignKey(
- name: "FK_MethodicaCommissions_Employees_HeadMCId",
- column: x => x.HeadMCId,
- principalTable: "Employees",
- principalColumn: "Id");
- });
- migrationBuilder.InsertData(
- table: "FormsOfWorks",
- columns: new[] { "Id", "Name" },
- values: new object[,]
- {
- { new Guid("1df0cba6-ff73-40c2-abdf-961a9709eaaa"), "Проведение" },
- { new Guid("37287ef1-0f2b-4285-9ac4-9f1488ace769"), "Участие" },
- { new Guid("b4e09dae-2674-4e96-925f-d9043b546d23"), "Стажировка" },
- { new Guid("c1f8d268-888a-42a3-8cb0-1f4844288f7a"), "Публикация" }
- });
- migrationBuilder.InsertData(
- table: "MethodicaCommissions",
- columns: new[] { "Id", "HeadMCId", "IdHead", "Name" },
- values: new object[,]
- {
- { new Guid("12da9f6a-76f1-4fc0-8fd9-83e87339d72d"), null, null, "Информатика и вычислительная техника" },
- { new Guid("5170e2a5-c6a2-46d4-9b9f-c320a3a38489"), null, null, "Инструментальных дисциплин" },
- { new Guid("55d62715-6c8c-4edc-b24a-f40bc74c921b"), null, null, "Математических и естественно - научных дисциплин" },
- { new Guid("75a83ea4-1462-4509-a656-551d97c3b2ef"), null, null, "Специальности Преподавание в начальных классах" },
- { new Guid("785180c4-76d2-4198-9097-1f7468fb33fa"), null, null, "Экономика и управление, логистика" },
- { new Guid("7db12177-6b42-4e46-aaf3-7c0cfd898bf4"), null, null, "Общественных и правовых дисциплин" },
- { new Guid("89f72d9d-2c0f-4f6d-b260-1b8c5ad22562"), null, null, "Дисциплин физической культуры и БЖД" },
- { new Guid("8e9ba4b0-5b6e-4afe-bc52-1ff89478fffd"), null, null, "Музыкальных дисциплин" },
- { new Guid("a3da2342-8d6d-4d41-b93b-3a129a0df358"), null, null, "Специальности Дошкольное образование" },
- { new Guid("ab1ace23-f7cd-4b5c-b3ca-6d7569c8f1f5"), null, null, "Специальностей Товароведение, Коммерция" },
- { new Guid("ad5ecee4-1b03-4c38-826f-9c48264f8964"), null, null, "Иностранного языка" },
- { new Guid("c09cd729-72fe-4fb2-bdbe-ba74605f3e1a"), null, null, "Специальностей Банковское дело, ДОУ" },
- { new Guid("de91711c-58d4-4a6c-be28-361418218d11"), null, null, "Гуманитарных дисциплин" }
- });
- migrationBuilder.CreateIndex(
- name: "IX_AspNetRoleClaims_RoleId",
- table: "AspNetRoleClaims",
- column: "RoleId");
- migrationBuilder.CreateIndex(
- name: "RoleNameIndex",
- table: "AspNetRoles",
- column: "NormalizedName",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserClaims_UserId",
- table: "AspNetUserClaims",
- column: "UserId");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserLogins_UserId",
- table: "AspNetUserLogins",
- column: "UserId");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserRoles_RoleId",
- table: "AspNetUserRoles",
- column: "RoleId");
- migrationBuilder.CreateIndex(
- name: "EmailIndex",
- table: "AspNetUsers",
- column: "NormalizedEmail");
- migrationBuilder.CreateIndex(
- name: "UserNameIndex",
- table: "AspNetUsers",
- column: "NormalizedUserName",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Employees_UserId",
- table: "Employees",
- column: "UserId",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Events_EmployeeId",
- table: "Events",
- column: "EmployeeId");
- migrationBuilder.CreateIndex(
- name: "IX_Events_FormOfWorkFKId",
- table: "Events",
- column: "FormOfWorkFKId");
- migrationBuilder.CreateIndex(
- name: "IX_MethodicaCommissions_HeadMCId",
- table: "MethodicaCommissions",
- column: "HeadMCId");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AspNetRoleClaims");
- migrationBuilder.DropTable(
- name: "AspNetUserClaims");
- migrationBuilder.DropTable(
- name: "AspNetUserLogins");
- migrationBuilder.DropTable(
- name: "AspNetUserRoles");
- migrationBuilder.DropTable(
- name: "AspNetUserTokens");
- migrationBuilder.DropTable(
- name: "Events");
- migrationBuilder.DropTable(
- name: "MethodicaCommissions");
- migrationBuilder.DropTable(
- name: "AspNetRoles");
- migrationBuilder.DropTable(
- name: "FormsOfWorks");
- migrationBuilder.DropTable(
- name: "Employees");
- migrationBuilder.DropTable(
- name: "AspNetUsers");
- }
- }
- }
|