20240323162103_InitialCreate.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
  4. namespace Products.Business.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class InitialCreate : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "Products",
  14. columns: table => new
  15. {
  16. Id = table.Column<int>(type: "INTEGER", nullable: false)
  17. .Annotation("Sqlite:Autoincrement", true),
  18. Name = table.Column<string>(type: "TEXT", nullable: false),
  19. Color = table.Column<int>(type: "INTEGER", nullable: false),
  20. Brand = table.Column<string>(type: "TEXT", nullable: false)
  21. },
  22. constraints: table =>
  23. {
  24. table.PrimaryKey("PK_Products", x => x.Id);
  25. });
  26. migrationBuilder.CreateTable(
  27. name: "Users",
  28. columns: table => new
  29. {
  30. Id = table.Column<int>(type: "INTEGER", nullable: false)
  31. .Annotation("Sqlite:Autoincrement", true),
  32. Name = table.Column<string>(type: "TEXT", nullable: false),
  33. Color = table.Column<int>(type: "INTEGER", nullable: false),
  34. Brand = table.Column<string>(type: "TEXT", nullable: false)
  35. },
  36. constraints: table =>
  37. {
  38. table.PrimaryKey("PK_Users", x => x.Id);
  39. });
  40. migrationBuilder.InsertData(
  41. table: "Products",
  42. columns: new[] { "Id", "Brand", "Color", "Name" },
  43. values: new object[,]
  44. {
  45. { 1, "Brand Azul", 2, "Product Azul" },
  46. { 2, "Brand Rojo", 0, "Product Rojo" },
  47. { 3, "Brand Verde", 1, "Product Verde" },
  48. { 4, "Brand Azul #2", 2, "Product Azul #2" },
  49. { 5, "Brand Rojo #2", 0, "Product Rojo #2" }
  50. });
  51. }
  52. /// <inheritdoc />
  53. protected override void Down(MigrationBuilder migrationBuilder)
  54. {
  55. migrationBuilder.DropTable(
  56. name: "Products");
  57. migrationBuilder.DropTable(
  58. name: "Users");
  59. }
  60. }
  61. }