| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore.Migrations;
- namespace BulkPrintingAPI.Migrations
- {
- public partial class InitialCreate : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Warehouses",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false),
- Name = table.Column<string>(maxLength: 50, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Warehouses", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Accounts",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false),
- Balance = table.Column<decimal>(nullable: false),
- Name = table.Column<string>(maxLength: 50, nullable: true),
- Reference = table.Column<string>(maxLength: 50, nullable: true),
- Status = table.Column<int>(nullable: false),
- WarehouseId = table.Column<int>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Accounts", x => x.Id);
- table.ForeignKey(
- name: "FK_Accounts_Warehouses_WarehouseId",
- column: x => x.WarehouseId,
- principalTable: "Warehouses",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Users",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false),
- AccountId = table.Column<int>(nullable: false),
- CanPrintOffline = table.Column<bool>(nullable: false),
- CanPrintOnline = table.Column<bool>(nullable: false),
- CanReprintOffline = table.Column<bool>(nullable: false),
- CanReprintOnline = table.Column<bool>(nullable: false),
- Enabled = table.Column<bool>(nullable: false),
- FirstName = table.Column<string>(maxLength: 50, nullable: true),
- LastLogin = table.Column<DateTime>(nullable: false),
- Level = table.Column<int>(nullable: false),
- OfflinePrintValue = table.Column<decimal>(nullable: false),
- OfflineReprintValue = table.Column<decimal>(nullable: false),
- OnlinePrintValue = table.Column<decimal>(nullable: false),
- OnlineReprintValue = table.Column<decimal>(nullable: false),
- Surname = table.Column<string>(maxLength: 50, nullable: true),
- System = table.Column<int>(nullable: false),
- Username = table.Column<string>(maxLength: 50, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Users", x => x.Id);
- table.ForeignKey(
- name: "FK_Users_Accounts_AccountId",
- column: x => x.AccountId,
- principalTable: "Accounts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Vendors",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false),
- AccountId = table.Column<int>(nullable: false),
- SerialNumber = table.Column<string>(maxLength: 50, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Vendors", x => x.Id);
- table.ForeignKey(
- name: "FK_Vendors_Accounts_AccountId",
- column: x => x.AccountId,
- principalTable: "Accounts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateIndex(
- name: "IX_Accounts_WarehouseId",
- table: "Accounts",
- column: "WarehouseId");
- migrationBuilder.CreateIndex(
- name: "IX_Users_AccountId",
- table: "Users",
- column: "AccountId");
- migrationBuilder.CreateIndex(
- name: "IX_Vendors_AccountId",
- table: "Vendors",
- column: "AccountId");
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Users");
- migrationBuilder.DropTable(
- name: "Vendors");
- migrationBuilder.DropTable(
- name: "Accounts");
- migrationBuilder.DropTable(
- name: "Warehouses");
- }
- }
- }
|