Code-Style: Remove broken if
This commit is contained in:
@@ -19,85 +19,38 @@ namespace SZUAbsolventenverein.Module.HallOfFame.Migrations
|
|||||||
{
|
{
|
||||||
var entityBuilder = new HallOfFameEntityBuilder(migrationBuilder, ActiveDatabase);
|
var entityBuilder = new HallOfFameEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
|
||||||
// Add new columns manually since we are upgrading an existing table
|
migrationBuilder.AddColumn<int>(
|
||||||
// Note: Integer columns are generated as default/nullable depending on definition, Oqtane Helpers handle generic types.
|
name: "Year",
|
||||||
// Using logic similar to Oqtane.Migrations.EntityBuilders
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
if (ActiveDatabase.Name == "Sqlite") // Sqlite specific or generic
|
migrationBuilder.AddColumn<string>(
|
||||||
{
|
name: "Description",
|
||||||
// Generic AddColumn: Table, Name, Type, Nullable
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
// However, Oqtane EntityBuilder usually builds tables.
|
nullable: true);
|
||||||
// We will use migrationBuilder directly via helper if possible or standard AddColumn.
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "Year",
|
name: "Image",
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
nullable: false,
|
nullable: true);
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "Description",
|
name: "Link",
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
nullable: true); // Allow nulls initially or empty? MaxString usually nullable in Oqtane context? Let's check.
|
nullable: true);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "Image",
|
name: "Status",
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
nullable: true);
|
maxLength: 50,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<int>(
|
||||||
name: "Link",
|
name: "UserId",
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
table: "SZUAbsolventenvereinHallOfFame",
|
||||||
nullable: true);
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Status",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
maxLength: 50,
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "UserId",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// For SQL Server / others, simply use same AddColumn but allow EF Core to handle types
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "Year",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Description",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Image",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Link",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Status",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
maxLength: 50,
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "UserId",
|
|
||||||
table: "SZUAbsolventenvereinHallOfFame",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
|||||||
Reference in New Issue
Block a user