using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DatabaseImplement.Migrations { /// public partial class second : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "OnlyImportantMails", table: "Users", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "MediaFiles", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false), Location = table.Column(type: "text", nullable: false), ProductId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MediaFiles", x => x.Id); }); migrationBuilder.CreateTable( name: "Products", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false), Price = table.Column(type: "double precision", nullable: false), Rate = table.Column(type: "double precision", nullable: false), IsBeingSold = table.Column(type: "boolean", nullable: false), Amount = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Products", x => x.Id); }); migrationBuilder.CreateTable( name: "Purchases", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DatePurchase = table.Column(type: "timestamp with time zone", nullable: false), Status = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Purchases", x => x.Id); }); migrationBuilder.CreateTable( name: "Sells", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateSell = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sells", x => x.Id); }); migrationBuilder.CreateTable( name: "Suppliers", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false), Deals = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Suppliers", x => x.Id); }); migrationBuilder.CreateTable( name: "SupplierProducts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), SupplierId = table.Column(type: "uuid", nullable: false), ProductId = table.Column(type: "uuid", nullable: false), Count = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SupplierProducts", x => x.Id); table.ForeignKey( name: "FK_SupplierProducts_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SupplierProducts_Suppliers_SupplierId", column: x => x.SupplierId, principalTable: "Suppliers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Supplies", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false), Price = table.Column(type: "double precision", nullable: false), SupplierId = table.Column(type: "uuid", nullable: false), Date = table.Column(type: "timestamp with time zone", nullable: false), Status = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Supplies", x => x.Id); table.ForeignKey( name: "FK_Supplies_Suppliers_SupplierId", column: x => x.SupplierId, principalTable: "Suppliers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "SupplyProducts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), SupplyId = table.Column(type: "uuid", nullable: false), ProductId = table.Column(type: "uuid", nullable: false), Count = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SupplyProducts", x => x.Id); table.ForeignKey( name: "FK_SupplyProducts_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SupplyProducts_Supplies_SupplyId", column: x => x.SupplyId, principalTable: "Supplies", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_SupplierProducts_ProductId", table: "SupplierProducts", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_SupplierProducts_SupplierId", table: "SupplierProducts", column: "SupplierId"); migrationBuilder.CreateIndex( name: "IX_Supplies_SupplierId", table: "Supplies", column: "SupplierId"); migrationBuilder.CreateIndex( name: "IX_SupplyProducts_ProductId", table: "SupplyProducts", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_SupplyProducts_SupplyId", table: "SupplyProducts", column: "SupplyId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "MediaFiles"); migrationBuilder.DropTable( name: "Purchases"); migrationBuilder.DropTable( name: "Sells"); migrationBuilder.DropTable( name: "SupplierProducts"); migrationBuilder.DropTable( name: "SupplyProducts"); migrationBuilder.DropTable( name: "Products"); migrationBuilder.DropTable( name: "Supplies"); migrationBuilder.DropTable( name: "Suppliers"); migrationBuilder.DropColumn( name: "OnlyImportantMails", table: "Users"); } } }