63 lines
2.4 KiB
C#
63 lines
2.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace Moonlight.Api.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedUsersAndSettings : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.EnsureSchema(
|
|
name: "core");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SettingsOptions",
|
|
schema: "core",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
|
Value = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SettingsOptions", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Users",
|
|
schema: "core",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
Email = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
|
|
InvalidateTimestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Users", x => x.Id);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "SettingsOptions",
|
|
schema: "core");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Users",
|
|
schema: "core");
|
|
}
|
|
}
|
|
}
|