Finished database management and user authentication

This commit is contained in:
2024-07-13 16:37:36 +02:00
parent fe5b5d28eb
commit c1ac7f9972
47 changed files with 1620 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
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");
}
}
}