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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Operator = table.Column(type: "integer", nullable: false), Content = table.Column(type: "text", nullable: false), AddTime = table.Column(type: "timestamp with time zone", nullable: false), Student = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Comments", x => x.Id); }); migrationBuilder.CreateTable( name: "Sessions", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Day = table.Column(type: "timestamp with time zone", nullable: false), BeginTime = table.Column(type: "timestamp with time zone", nullable: false), Place = table.Column(type: "text", nullable: false), Chiefs = table.Column>(type: "integer[]", nullable: true), Capacity = table.Column(type: "integer", nullable: false), SendSMS = table.Column(type: "boolean", nullable: false), Students = table.Column>(type: "integer[]", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Sessions", x => x.Id); }); migrationBuilder.CreateTable( name: "SMS", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Host = table.Column(type: "integer", nullable: false), Tel = table.Column(type: "text", nullable: true), Data = table.Column>(type: "text[]", nullable: true), Type = table.Column(type: "integer", nullable: false), Sender = table.Column(type: "text", nullable: true), SendTime = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: true), Stuid = table.Column(type: "text", nullable: true), Sex = table.Column(type: "integer", nullable: false), Grade = table.Column(type: "integer", nullable: false), Yard = table.Column(type: "integer", nullable: false), Major = table.Column(type: "text", nullable: true), Email = table.Column(type: "text", nullable: true), Tel = table.Column(type: "text", nullable: true), Exp = table.Column(type: "integer", nullable: false), InterviewTime = table.Column(type: "integer", nullable: false), Submissions = table.Column>(type: "integer[]", nullable: true), Messages = table.Column>(type: "integer[]", nullable: true), Timelist = table.Column>(type: "integer[]", nullable: true), Comments = table.Column>(type: "integer[]", nullable: true), Score = table.Column(type: "integer", nullable: false), Status = table.Column(type: "integer", nullable: false), LastSubmission = table.Column(type: "timestamp with time zone", nullable: false), RegisterTime = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Host = table.Column(type: "integer", nullable: false), Name = table.Column(type: "text", nullable: true), Stuid = table.Column(type: "text", nullable: true), Sex = table.Column(type: "integer", nullable: false), Yard = table.Column(type: "integer", nullable: false), Grade = table.Column(type: "integer", nullable: false), Major = table.Column(type: "text", nullable: true), Email = table.Column(type: "text", nullable: true), Tel = table.Column(type: "text", nullable: true), Exp = table.Column(type: "integer", nullable: false), Timelist = table.Column>(type: "integer[]", nullable: true), Address = table.Column(type: "text", nullable: true), SubmitTime = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), stuID = table.Column(type: "text", nullable: true), Name = table.Column(type: "text", nullable: true), Secret = table.Column(type: "text", nullable: true), isManager = table.Column(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"); } } }