using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace AutoCatCore.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Users", columns: table => new { Email = table.Column(type: "TEXT", maxLength: 50, nullable: false), Token = table.Column(type: "TEXT", maxLength: 300, nullable: true), FirebaseIdToken = table.Column(type: "TEXT", maxLength: 300, nullable: true), FirebaseRefreshToken = table.Column(type: "TEXT", maxLength: 300, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Email); }); migrationBuilder.CreateTable( name: "VehicleEngine", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Number = table.Column(type: "TEXT", maxLength: 100, nullable: true), Volume = table.Column(type: "INTEGER", nullable: true), PowerKw = table.Column(type: "REAL", nullable: true), PowerHp = table.Column(type: "REAL", nullable: true), FuelType = table.Column(type: "TEXT", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleEngine", x => x.Id); }); migrationBuilder.CreateTable( name: "VehicleName", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Original = table.Column(type: "TEXT", maxLength: 100, nullable: true), Normalized = table.Column(type: "TEXT", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleName", x => x.Id); }); migrationBuilder.CreateTable( name: "VehicleBrand", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), NameId = table.Column(type: "INTEGER", nullable: true), Logo = table.Column(type: "TEXT", maxLength: 200, nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleBrand", x => x.Id); table.ForeignKey( name: "FK_VehicleBrand_VehicleName_NameId", column: x => x.NameId, principalTable: "VehicleName", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "VehicleModel", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), NameId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleModel", x => x.Id); table.ForeignKey( name: "FK_VehicleModel_VehicleName_NameId", column: x => x.NameId, principalTable: "VehicleName", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Vehicles", columns: table => new { Number = table.Column(type: "TEXT", maxLength: 10, nullable: false), CurrentNumber = table.Column(type: "TEXT", maxLength: 10, nullable: true), Vin1 = table.Column(type: "TEXT", maxLength: 50, nullable: true), Vin2 = table.Column(type: "TEXT", maxLength: 50, nullable: true), Sts = table.Column(type: "TEXT", maxLength: 50, nullable: true), Pts = table.Column(type: "TEXT", maxLength: 50, nullable: true), BrandId = table.Column(type: "INTEGER", nullable: true), ModelId = table.Column(type: "INTEGER", nullable: true), Color = table.Column(type: "TEXT", maxLength: 100, nullable: true), Year = table.Column(type: "INTEGER", nullable: true), Category = table.Column(type: "TEXT", maxLength: 100, nullable: true), IsRightWheel = table.Column(type: "INTEGER", nullable: true), IsJapanese = table.Column(type: "INTEGER", nullable: true), AddedDate = table.Column(type: "REAL", nullable: true), UpdatedDate = table.Column(type: "REAL", nullable: true), AddedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), EngineId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Vehicles", x => x.Number); table.ForeignKey( name: "FK_Vehicles_VehicleBrand_BrandId", column: x => x.BrandId, principalTable: "VehicleBrand", principalColumn: "Id"); table.ForeignKey( name: "FK_Vehicles_VehicleEngine_EngineId", column: x => x.EngineId, principalTable: "VehicleEngine", principalColumn: "Id"); table.ForeignKey( name: "FK_Vehicles_VehicleModel_ModelId", column: x => x.ModelId, principalTable: "VehicleModel", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Osago", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Number = table.Column(type: "TEXT", maxLength: 50, nullable: true), Date = table.Column(type: "REAL", nullable: true), Vin = table.Column(type: "TEXT", maxLength: 50, nullable: true), PlateNumber = table.Column(type: "TEXT", maxLength: 50, nullable: true), Name = table.Column(type: "TEXT", maxLength: 100, nullable: true), Status = table.Column(type: "TEXT", maxLength: 100, nullable: true), Restrictions = table.Column(type: "TEXT", maxLength: 500, nullable: true), Insurant = table.Column(type: "TEXT", maxLength: 100, nullable: true), Owner = table.Column(type: "TEXT", maxLength: 100, nullable: true), UsageRegion = table.Column(type: "TEXT", maxLength: 100, nullable: true), VehicleNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Osago", x => x.Id); table.ForeignKey( name: "FK_Osago_Vehicles_VehicleNumber", column: x => x.VehicleNumber, principalTable: "Vehicles", principalColumn: "Number"); }); migrationBuilder.CreateTable( name: "VehicleAd", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Url = table.Column(type: "TEXT", maxLength: 200, nullable: true), Price = table.Column(type: "TEXT", maxLength: 50, nullable: true), Date = table.Column(type: "REAL", maxLength: 50, nullable: true), Mileage = table.Column(type: "TEXT", maxLength: 50, nullable: true), Region = table.Column(type: "TEXT", maxLength: 100, nullable: true), City = table.Column(type: "TEXT", maxLength: 100, nullable: true), AdDescription = table.Column(type: "TEXT", maxLength: 500, nullable: true), Photos = table.Column(type: "TEXT", nullable: true), VehicleNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleAd", x => x.Id); table.ForeignKey( name: "FK_VehicleAd_Vehicles_VehicleNumber", column: x => x.VehicleNumber, principalTable: "Vehicles", principalColumn: "Number"); }); migrationBuilder.CreateTable( name: "VehicleEvent", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Date = table.Column(type: "REAL", nullable: true), Latitude = table.Column(type: "REAL", nullable: true), Longitude = table.Column(type: "REAL", nullable: true), Address = table.Column(type: "TEXT", maxLength: 100, nullable: true), VehicleNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleEvent", x => x.Id); table.ForeignKey( name: "FK_VehicleEvent_Vehicles_VehicleNumber", column: x => x.VehicleNumber, principalTable: "Vehicles", principalColumn: "Number"); }); migrationBuilder.CreateTable( name: "VehicleOwnershipPeriod", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), LastOperation = table.Column(type: "TEXT", maxLength: 500, nullable: true), OwnerType = table.Column(type: "TEXT", maxLength: 100, nullable: true), From = table.Column(type: "INTEGER", nullable: true), To = table.Column(type: "INTEGER", nullable: true), Region = table.Column(type: "TEXT", maxLength: 300, nullable: true), RegistrationRegion = table.Column(type: "TEXT", maxLength: 300, nullable: true), Locality = table.Column(type: "TEXT", maxLength: 100, nullable: true), Code = table.Column(type: "TEXT", maxLength: 100, nullable: true), Street = table.Column(type: "TEXT", maxLength: 100, nullable: true), Building = table.Column(type: "TEXT", maxLength: 100, nullable: true), Inn = table.Column(type: "TEXT", maxLength: 100, nullable: true), VehicleNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehicleOwnershipPeriod", x => x.Id); table.ForeignKey( name: "FK_VehicleOwnershipPeriod_Vehicles_VehicleNumber", column: x => x.VehicleNumber, principalTable: "Vehicles", principalColumn: "Number"); }); migrationBuilder.CreateTable( name: "VehiclePhoto", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Brand = table.Column(type: "TEXT", maxLength: 100, nullable: true), Model = table.Column(type: "TEXT", maxLength: 100, nullable: true), Date = table.Column(type: "REAL", nullable: true), Url = table.Column(type: "TEXT", maxLength: 500, nullable: true), VehicleNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VehiclePhoto", x => x.Id); table.ForeignKey( name: "FK_VehiclePhoto_Vehicles_VehicleNumber", column: x => x.VehicleNumber, principalTable: "Vehicles", principalColumn: "Number"); }); migrationBuilder.CreateIndex( name: "IX_Osago_VehicleNumber", table: "Osago", column: "VehicleNumber"); migrationBuilder.CreateIndex( name: "IX_VehicleAd_VehicleNumber", table: "VehicleAd", column: "VehicleNumber"); migrationBuilder.CreateIndex( name: "IX_VehicleBrand_NameId", table: "VehicleBrand", column: "NameId"); migrationBuilder.CreateIndex( name: "IX_VehicleEvent_VehicleNumber", table: "VehicleEvent", column: "VehicleNumber"); migrationBuilder.CreateIndex( name: "IX_VehicleModel_NameId", table: "VehicleModel", column: "NameId"); migrationBuilder.CreateIndex( name: "IX_VehicleOwnershipPeriod_VehicleNumber", table: "VehicleOwnershipPeriod", column: "VehicleNumber"); migrationBuilder.CreateIndex( name: "IX_VehiclePhoto_VehicleNumber", table: "VehiclePhoto", column: "VehicleNumber"); migrationBuilder.CreateIndex( name: "IX_Vehicles_BrandId", table: "Vehicles", column: "BrandId"); migrationBuilder.CreateIndex( name: "IX_Vehicles_EngineId", table: "Vehicles", column: "EngineId"); migrationBuilder.CreateIndex( name: "IX_Vehicles_ModelId", table: "Vehicles", column: "ModelId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Osago"); migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "VehicleAd"); migrationBuilder.DropTable( name: "VehicleEvent"); migrationBuilder.DropTable( name: "VehicleOwnershipPeriod"); migrationBuilder.DropTable( name: "VehiclePhoto"); migrationBuilder.DropTable( name: "Vehicles"); migrationBuilder.DropTable( name: "VehicleBrand"); migrationBuilder.DropTable( name: "VehicleEngine"); migrationBuilder.DropTable( name: "VehicleModel"); migrationBuilder.DropTable( name: "VehicleName"); } } }