902942eee6
continuous-integration/drone/pr Build is passing
Sealed qualifying public classes Migrated database changes
73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using System;
|
|
using LiteCharms.Features.Models;
|
|
using LiteCharms.Features.TechShop.Products.Models;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedProductMetadata : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<bool>(
|
|
name: "Active",
|
|
table: "Products",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false,
|
|
oldClrType: typeof(bool),
|
|
oldType: "boolean",
|
|
oldDefaultValue: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "CreatedAt",
|
|
table: "Products",
|
|
type: "timestamp with time zone",
|
|
nullable: false,
|
|
defaultValueSql: "now()");
|
|
|
|
migrationBuilder.AddColumn<ProductMetadata>(
|
|
name: "Metadata",
|
|
table: "Products",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "UpdatedAt",
|
|
table: "Products",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "CreatedAt",
|
|
table: "Products");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Metadata",
|
|
table: "Products");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UpdatedAt",
|
|
table: "Products");
|
|
|
|
migrationBuilder.AlterColumn<bool>(
|
|
name: "Active",
|
|
table: "Products",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: true,
|
|
oldClrType: typeof(bool),
|
|
oldType: "boolean",
|
|
oldDefaultValue: false);
|
|
}
|
|
}
|
|
}
|