/
kochkatech
/
Queue
Обзор
Документация
Войти
/
kochkatech
/
Queue
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
dev
src/Queue.Data/Migrations/20260727144026_InitialCreate.cs
217 строк
9 KB
kochkareal
fix: пересоздать InitialCreate штатным dotnet ef (отсутствовал Designer.cs)
27 июл 2026, 17:41
27 июл 2026, 17:41
48fcaec
Код
Авторство
О чём код?
using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Queue.Data.Migrations { /// <inheritdoc /> public partial class InitialCreate : Migration { /// <inheritdoc /> protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Employees", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), FullName = table.Column<string>(type: "TEXT", nullable: false), Login = table.Column<string>(type: "TEXT", nullable: false), PasswordHash = table.Column<string>(type: "TEXT", nullable: false), Role = table.Column<int>(type: "INTEGER", nullable: false), CurrentWindowId = table.Column<int>(type: "INTEGER", nullable: true), IsActive = table.Column<bool>(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Employees", x => x.Id); }); migrationBuilder.CreateTable( name: "IntegrationLogEntries", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false), Success = table.Column<bool>(type: "INTEGER", nullable: false), Message = table.Column<string>(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_IntegrationLogEntries", x => x.Id); }); migrationBuilder.CreateTable( name: "IntegrationSettings", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Channel = table.Column<int>(type: "INTEGER", nullable: false), Endpoint = table.Column<string>(type: "TEXT", nullable: false), Login = table.Column<string>(type: "TEXT", nullable: true), EncryptedCredentials = table.Column<string>(type: "TEXT", nullable: true), SyncScheduleCron = table.Column<string>(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_IntegrationSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "Organizations", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column<string>(type: "TEXT", nullable: false), LogoPath = table.Column<string>(type: "TEXT", nullable: true), LicenseKey = table.Column<string>(type: "TEXT", nullable: true), TimeZone = table.Column<string>(type: "TEXT", nullable: false), MainColorHex = table.Column<string>(type: "TEXT", nullable: true), FocusColorHex = table.Column<string>(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Organizations", x => x.Id); }); migrationBuilder.CreateTable( name: "Services", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column<string>(type: "TEXT", nullable: false), Code = table.Column<string>(type: "TEXT", nullable: false), AverageDurationMinutes = table.Column<int>(type: "INTEGER", nullable: false), IsActive = table.Column<bool>(type: "INTEGER", nullable: false), SortOrder = table.Column<int>(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Services", x => x.Id); }); migrationBuilder.CreateTable( name: "Tickets", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Number = table.Column<string>(type: "TEXT", nullable: false), ServiceId = table.Column<int>(type: "INTEGER", nullable: false), WindowId = table.Column<int>(type: "INTEGER", nullable: true), EmployeeId = table.Column<int>(type: "INTEGER", nullable: true), Status = table.Column<int>(type: "INTEGER", nullable: false), CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false), CalledAt = table.Column<DateTime>(type: "TEXT", nullable: true), StartedAt = table.Column<DateTime>(type: "TEXT", nullable: true), FinishedAt = table.Column<DateTime>(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Tickets", x => x.Id); }); migrationBuilder.CreateTable( name: "Windows", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column<string>(type: "TEXT", nullable: false), IsActive = table.Column<bool>(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Windows", x => x.Id); }); migrationBuilder.CreateTable( name: "WorkSchedules", columns: table => new { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false), OpenTime = table.Column<TimeOnly>(type: "TEXT", nullable: false), CloseTime = table.Column<TimeOnly>(type: "TEXT", nullable: false), IsClosed = table.Column<bool>(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WorkSchedules", x => x.Id); }); migrationBuilder.CreateTable( name: "ServiceWindowAssignments", columns: table => new { ServiceId = table.Column<int>(type: "INTEGER", nullable: false), WindowId = table.Column<int>(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ServiceWindowAssignments", x => new { x.ServiceId, x.WindowId }); table.ForeignKey( name: "FK_ServiceWindowAssignments_Services_ServiceId", column: x => x.ServiceId, principalTable: "Services", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceWindowAssignments_Windows_WindowId", column: x => x.WindowId, principalTable: "Windows", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Employees_Login", table: "Employees", column: "Login", unique: true); migrationBuilder.CreateIndex( name: "IX_ServiceWindowAssignments_WindowId", table: "ServiceWindowAssignments", column: "WindowId"); } /// <inheritdoc /> protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Employees"); migrationBuilder.DropTable( name: "IntegrationLogEntries"); migrationBuilder.DropTable( name: "IntegrationSettings"); migrationBuilder.DropTable( name: "Organizations"); migrationBuilder.DropTable( name: "ServiceWindowAssignments"); migrationBuilder.DropTable( name: "Tickets"); migrationBuilder.DropTable( name: "WorkSchedules"); migrationBuilder.DropTable( name: "Services"); migrationBuilder.DropTable( name: "Windows"); } } }