Web API for the bulk printing desktop application.

20170701135738_InitialCreate.cs 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.EntityFrameworkCore.Migrations;
  4. namespace BulkPrintingAPI.Migrations
  5. {
  6. public partial class InitialCreate : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "Warehouses",
  12. columns: table => new
  13. {
  14. Id = table.Column<int>(nullable: false),
  15. Name = table.Column<string>(maxLength: 50, nullable: true)
  16. },
  17. constraints: table =>
  18. {
  19. table.PrimaryKey("PK_Warehouses", x => x.Id);
  20. });
  21. migrationBuilder.CreateTable(
  22. name: "Accounts",
  23. columns: table => new
  24. {
  25. Id = table.Column<int>(nullable: false),
  26. Balance = table.Column<decimal>(nullable: false),
  27. Name = table.Column<string>(maxLength: 50, nullable: true),
  28. Reference = table.Column<string>(maxLength: 50, nullable: true),
  29. Status = table.Column<int>(nullable: false),
  30. WarehouseId = table.Column<int>(nullable: false)
  31. },
  32. constraints: table =>
  33. {
  34. table.PrimaryKey("PK_Accounts", x => x.Id);
  35. table.ForeignKey(
  36. name: "FK_Accounts_Warehouses_WarehouseId",
  37. column: x => x.WarehouseId,
  38. principalTable: "Warehouses",
  39. principalColumn: "Id",
  40. onDelete: ReferentialAction.Cascade);
  41. });
  42. migrationBuilder.CreateTable(
  43. name: "Users",
  44. columns: table => new
  45. {
  46. Id = table.Column<int>(nullable: false),
  47. AccountId = table.Column<int>(nullable: false),
  48. CanPrintOffline = table.Column<bool>(nullable: false),
  49. CanPrintOnline = table.Column<bool>(nullable: false),
  50. CanReprintOffline = table.Column<bool>(nullable: false),
  51. CanReprintOnline = table.Column<bool>(nullable: false),
  52. Enabled = table.Column<bool>(nullable: false),
  53. FirstName = table.Column<string>(maxLength: 50, nullable: true),
  54. LastLogin = table.Column<DateTime>(nullable: false),
  55. Level = table.Column<int>(nullable: false),
  56. OfflinePrintValue = table.Column<decimal>(nullable: false),
  57. OfflineReprintValue = table.Column<decimal>(nullable: false),
  58. OnlinePrintValue = table.Column<decimal>(nullable: false),
  59. OnlineReprintValue = table.Column<decimal>(nullable: false),
  60. Surname = table.Column<string>(maxLength: 50, nullable: true),
  61. System = table.Column<int>(nullable: false),
  62. Username = table.Column<string>(maxLength: 50, nullable: true)
  63. },
  64. constraints: table =>
  65. {
  66. table.PrimaryKey("PK_Users", x => x.Id);
  67. table.ForeignKey(
  68. name: "FK_Users_Accounts_AccountId",
  69. column: x => x.AccountId,
  70. principalTable: "Accounts",
  71. principalColumn: "Id",
  72. onDelete: ReferentialAction.Cascade);
  73. });
  74. migrationBuilder.CreateTable(
  75. name: "Vendors",
  76. columns: table => new
  77. {
  78. Id = table.Column<int>(nullable: false),
  79. AccountId = table.Column<int>(nullable: false),
  80. SerialNumber = table.Column<string>(maxLength: 50, nullable: true)
  81. },
  82. constraints: table =>
  83. {
  84. table.PrimaryKey("PK_Vendors", x => x.Id);
  85. table.ForeignKey(
  86. name: "FK_Vendors_Accounts_AccountId",
  87. column: x => x.AccountId,
  88. principalTable: "Accounts",
  89. principalColumn: "Id",
  90. onDelete: ReferentialAction.Cascade);
  91. });
  92. migrationBuilder.CreateIndex(
  93. name: "IX_Accounts_WarehouseId",
  94. table: "Accounts",
  95. column: "WarehouseId");
  96. migrationBuilder.CreateIndex(
  97. name: "IX_Users_AccountId",
  98. table: "Users",
  99. column: "AccountId");
  100. migrationBuilder.CreateIndex(
  101. name: "IX_Vendors_AccountId",
  102. table: "Vendors",
  103. column: "AccountId");
  104. }
  105. protected override void Down(MigrationBuilder migrationBuilder)
  106. {
  107. migrationBuilder.DropTable(
  108. name: "Users");
  109. migrationBuilder.DropTable(
  110. name: "Vendors");
  111. migrationBuilder.DropTable(
  112. name: "Accounts");
  113. migrationBuilder.DropTable(
  114. name: "Warehouses");
  115. }
  116. }
  117. }