110 lines
3.2 KiB
C#
110 lines
3.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace DatabaseTest.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Security : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Tokens",
|
|
table: "Tokens");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Id",
|
|
table: "Tokens");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "OwnerId",
|
|
table: "Permissions");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Id",
|
|
table: "Users",
|
|
type: "TEXT",
|
|
maxLength: 36,
|
|
nullable: false,
|
|
oldClrType: typeof(long),
|
|
oldType: "INTEGER")
|
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "UserId",
|
|
table: "Tokens",
|
|
type: "TEXT",
|
|
maxLength: 36,
|
|
nullable: false,
|
|
oldClrType: typeof(long),
|
|
oldType: "INTEGER");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "UserId",
|
|
table: "Permissions",
|
|
type: "TEXT",
|
|
maxLength: 36,
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Tokens",
|
|
table: "Tokens",
|
|
column: "Token");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Tokens",
|
|
table: "Tokens");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UserId",
|
|
table: "Permissions");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "Id",
|
|
table: "Users",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "TEXT",
|
|
oldMaxLength: 36)
|
|
.Annotation("Sqlite:Autoincrement", true);
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "UserId",
|
|
table: "Tokens",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "TEXT",
|
|
oldMaxLength: 36);
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "Id",
|
|
table: "Tokens",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0L)
|
|
.Annotation("Sqlite:Autoincrement", true);
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "OwnerId",
|
|
table: "Permissions",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0L);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Tokens",
|
|
table: "Tokens",
|
|
column: "Id");
|
|
}
|
|
}
|
|
}
|