using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace MyOffice.Migrations.Postgres.Migrations
{
///
public partial class init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False");
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
UserName = table.Column(type: "text", nullable: false, collation: "my_ci_collation"),
Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"),
PasswordHash = table.Column(type: "text", nullable: false),
FirstName = table.Column(type: "text", nullable: true),
LastName = table.Column(type: "text", nullable: true),
FullName = table.Column(type: "text", nullable: true),
IsEmailConfirmed = table.Column(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserClaims",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CreatedOn = table.Column(type: "timestamp with time zone", nullable: false),
UserId = table.Column(type: "uuid", nullable: false),
ExternalId = table.Column(type: "text", nullable: false),
Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"),
Provider = table.Column(type: "text", nullable: false, collation: "my_ci_collation")
},
constraints: table =>
{
table.PrimaryKey("PK_UserClaims", x => x.Id);
table.ForeignKey(
name: "FK_UserClaims_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserClaims_UserId",
table: "UserClaims",
column: "UserId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "UserClaims");
migrationBuilder.DropTable(
name: "Users");
}
}
}