45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Api.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class CreateDb : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Students",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
FirstName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
LastName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
AlbumNumber = table.Column<string>(type: "nvarchar(6)", maxLength: 6, nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
LastModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Students", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Students_AlbumNumber",
|
|
table: "Students",
|
|
column: "AlbumNumber",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Students");
|
|
}
|
|
}
|
|
}
|