JPHD-2021-backend/Migrations/20220222090619_initial.cs

161 lines
8.1 KiB
C#

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace _2021_backend.Migrations
{
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Comments",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Operator = table.Column<int>(type: "integer", nullable: false),
Content = table.Column<string>(type: "text", nullable: false),
AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Student = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Comments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Sessions",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Day = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Place = table.Column<string>(type: "text", nullable: false),
Chiefs = table.Column<List<int>>(type: "integer[]", nullable: true),
Capacity = table.Column<int>(type: "integer", nullable: false),
SendSMS = table.Column<bool>(type: "boolean", nullable: false),
Students = table.Column<List<int>>(type: "integer[]", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Sessions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SMS",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Host = table.Column<int>(type: "integer", nullable: false),
Tel = table.Column<string>(type: "text", nullable: true),
Data = table.Column<List<string>>(type: "text[]", nullable: true),
Type = table.Column<int>(type: "integer", nullable: false),
Sender = table.Column<string>(type: "text", nullable: true),
SendTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SMS", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Students",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: true),
Stuid = table.Column<string>(type: "text", nullable: true),
Sex = table.Column<int>(type: "integer", nullable: false),
Grade = table.Column<int>(type: "integer", nullable: false),
Yard = table.Column<int>(type: "integer", nullable: false),
Major = table.Column<string>(type: "text", nullable: true),
Email = table.Column<string>(type: "text", nullable: true),
Tel = table.Column<string>(type: "text", nullable: true),
Exp = table.Column<int>(type: "integer", nullable: false),
InterviewTime = table.Column<int>(type: "integer", nullable: false),
Submissions = table.Column<List<int>>(type: "integer[]", nullable: true),
Messages = table.Column<List<int>>(type: "integer[]", nullable: true),
Timelist = table.Column<List<int>>(type: "integer[]", nullable: true),
Comments = table.Column<List<int>>(type: "integer[]", nullable: true),
Score = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
LastSubmission = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
RegisterTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Students", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Submissions",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Host = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Stuid = table.Column<string>(type: "text", nullable: true),
Sex = table.Column<int>(type: "integer", nullable: false),
Yard = table.Column<int>(type: "integer", nullable: false),
Grade = table.Column<int>(type: "integer", nullable: false),
Major = table.Column<string>(type: "text", nullable: true),
Email = table.Column<string>(type: "text", nullable: true),
Tel = table.Column<string>(type: "text", nullable: true),
Exp = table.Column<int>(type: "integer", nullable: false),
Timelist = table.Column<List<int>>(type: "integer[]", nullable: true),
Address = table.Column<string>(type: "text", nullable: true),
SubmitTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Submissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
stuID = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: true),
Secret = table.Column<string>(type: "text", nullable: true),
isManager = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Comments");
migrationBuilder.DropTable(
name: "Sessions");
migrationBuilder.DropTable(
name: "SMS");
migrationBuilder.DropTable(
name: "Students");
migrationBuilder.DropTable(
name: "Submissions");
migrationBuilder.DropTable(
name: "Users");
}
}
}