Новая миграция
This commit is contained in:
423
LiquidCode/Migrations/20251022204407_Initial.Designer.cs
generated
423
LiquidCode/Migrations/20251022204407_Initial.Designer.cs
generated
@@ -1,423 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LiquidCode.Infrastructure.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
[DbContext(typeof(LiquidDbContext))]
|
||||
[Migration("20251022204407_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMission", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AuthorId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("author_id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateTime?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("difficulty");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("S3PrivateKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("s3private_key");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_missions");
|
||||
|
||||
b.HasIndex("AuthorId")
|
||||
.HasDatabaseName("ix_missions_author_id");
|
||||
|
||||
b.HasIndex("CreatedAt")
|
||||
.HasDatabaseName("ix_missions_created_at");
|
||||
|
||||
b.HasIndex("Difficulty")
|
||||
.HasDatabaseName("ix_missions_difficulty");
|
||||
|
||||
b.HasIndex("IsDeleted")
|
||||
.HasDatabaseName("ix_missions_is_deleted");
|
||||
|
||||
b.ToTable("missions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMissionPublicTextData", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30000)
|
||||
.HasColumnType("character varying(30000)")
|
||||
.HasColumnName("data");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<int>("MissionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mission_id");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_missions_text_data");
|
||||
|
||||
b.HasIndex("Language")
|
||||
.HasDatabaseName("ix_missions_text_data_language");
|
||||
|
||||
b.HasIndex("MissionId", "Language")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_missions_text_data_mission_id_language");
|
||||
|
||||
b.ToTable("missions_text_data", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbRefreshToken", b =>
|
||||
{
|
||||
b.Property<string>("Token")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("token");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<int>("DbUserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("db_user_id");
|
||||
|
||||
b.Property<DateTime>("Expires")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expires");
|
||||
|
||||
b.Property<string>("IpAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("ip_address");
|
||||
|
||||
b.Property<string>("OsName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("os_name");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Token")
|
||||
.HasName("pk_refresh_tokens");
|
||||
|
||||
b.HasIndex("DbUserId")
|
||||
.HasDatabaseName("ix_refresh_tokens_db_user_id");
|
||||
|
||||
b.HasIndex("Expires")
|
||||
.HasDatabaseName("ix_refresh_tokens_expires");
|
||||
|
||||
b.ToTable("refresh_tokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbSolution", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("character varying(16)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<string>("LanguageVersion")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("character varying(16)")
|
||||
.HasColumnName("language_version");
|
||||
|
||||
b.Property<int>("MissionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mission_id");
|
||||
|
||||
b.Property<string>("SourceCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)")
|
||||
.HasColumnName("source_code");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("time");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_solutions");
|
||||
|
||||
b.HasIndex("CreatedAt")
|
||||
.HasDatabaseName("ix_solutions_created_at");
|
||||
|
||||
b.HasIndex("MissionId")
|
||||
.HasDatabaseName("ix_solutions_mission_id");
|
||||
|
||||
b.HasIndex("Status")
|
||||
.HasDatabaseName("ix_solutions_status");
|
||||
|
||||
b.ToTable("solutions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateTime?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<string>("PassHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("pass_hash");
|
||||
|
||||
b.Property<string>("Salt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("salt");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.HasDatabaseName("ix_users_email");
|
||||
|
||||
b.HasIndex("IsDeleted")
|
||||
.HasDatabaseName("ix_users_is_deleted");
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_users_username");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbUserSubmit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateTime?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<int>("SolutionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("solution_id");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_user_submits");
|
||||
|
||||
b.HasIndex("CreatedAt")
|
||||
.HasDatabaseName("ix_user_submits_created_at");
|
||||
|
||||
b.HasIndex("IsDeleted")
|
||||
.HasDatabaseName("ix_user_submits_is_deleted");
|
||||
|
||||
b.HasIndex("SolutionId")
|
||||
.HasDatabaseName("ix_user_submits_solution_id");
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.HasDatabaseName("ix_user_submits_user_id");
|
||||
|
||||
b.ToTable("user_submits", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMission", b =>
|
||||
{
|
||||
b.HasOne("LiquidCode.Infrastructure.Database.Entities.DbUser", "Author")
|
||||
.WithMany()
|
||||
.HasForeignKey("AuthorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_missions_users_author_id");
|
||||
|
||||
b.Navigation("Author");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbRefreshToken", b =>
|
||||
{
|
||||
b.HasOne("LiquidCode.Infrastructure.Database.Entities.DbUser", "DbUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("DbUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_refresh_tokens_users_db_user_id");
|
||||
|
||||
b.Navigation("DbUser");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbSolution", b =>
|
||||
{
|
||||
b.HasOne("LiquidCode.Infrastructure.Database.Entities.DbMission", "Mission")
|
||||
.WithMany()
|
||||
.HasForeignKey("MissionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_solutions_missions_mission_id");
|
||||
|
||||
b.Navigation("Mission");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbUserSubmit", b =>
|
||||
{
|
||||
b.HasOne("LiquidCode.Infrastructure.Database.Entities.DbSolution", "Solution")
|
||||
.WithMany()
|
||||
.HasForeignKey("SolutionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_user_submits_solutions_solution_id");
|
||||
|
||||
b.HasOne("LiquidCode.Infrastructure.Database.Entities.DbUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_user_submits_users_user_id");
|
||||
|
||||
b.Navigation("Solution");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,272 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "missions_text_data",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
mission_id = table.Column<int>(type: "integer", nullable: false),
|
||||
language = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
data = table.Column<string>(type: "character varying(30000)", maxLength: 30000, nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_missions_text_data", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "users",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
username = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
pass_hash = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
salt = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_users", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "missions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
author_id = table.Column<int>(type: "integer", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
s3private_key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
difficulty = table.Column<int>(type: "integer", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_missions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_missions_users_author_id",
|
||||
column: x => x.author_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "refresh_tokens",
|
||||
columns: table => new
|
||||
{
|
||||
token = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
db_user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
expires = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
os_name = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false),
|
||||
ip_address = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_refresh_tokens", x => x.token);
|
||||
table.ForeignKey(
|
||||
name: "fk_refresh_tokens_users_db_user_id",
|
||||
column: x => x.db_user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "solutions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
mission_id = table.Column<int>(type: "integer", nullable: false),
|
||||
language = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: false),
|
||||
language_version = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: false),
|
||||
source_code = table.Column<string>(type: "character varying(10000)", maxLength: 10000, nullable: false),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_solutions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_solutions_missions_mission_id",
|
||||
column: x => x.mission_id,
|
||||
principalTable: "missions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_submits",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
solution_id = table.Column<int>(type: "integer", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_user_submits", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_submits_solutions_solution_id",
|
||||
column: x => x.solution_id,
|
||||
principalTable: "solutions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_submits_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_author_id",
|
||||
table: "missions",
|
||||
column: "author_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_created_at",
|
||||
table: "missions",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_difficulty",
|
||||
table: "missions",
|
||||
column: "difficulty");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_is_deleted",
|
||||
table: "missions",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_text_data_language",
|
||||
table: "missions_text_data",
|
||||
column: "language");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_text_data_mission_id_language",
|
||||
table: "missions_text_data",
|
||||
columns: new[] { "mission_id", "language" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_refresh_tokens_db_user_id",
|
||||
table: "refresh_tokens",
|
||||
column: "db_user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_refresh_tokens_expires",
|
||||
table: "refresh_tokens",
|
||||
column: "expires");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_created_at",
|
||||
table: "solutions",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_mission_id",
|
||||
table: "solutions",
|
||||
column: "mission_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_status",
|
||||
table: "solutions",
|
||||
column: "status");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_created_at",
|
||||
table: "user_submits",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_is_deleted",
|
||||
table: "user_submits",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_solution_id",
|
||||
table: "user_submits",
|
||||
column: "solution_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_user_id",
|
||||
table: "user_submits",
|
||||
column: "user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_email",
|
||||
table: "users",
|
||||
column: "email");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_is_deleted",
|
||||
table: "users",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_username",
|
||||
table: "users",
|
||||
column: "username",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "missions_text_data");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "refresh_tokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user_submits");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "solutions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "missions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "users");
|
||||
}
|
||||
}
|
||||
}
|
||||
1024
LiquidCode/Migrations/20251026201212_Lot.Designer.cs
generated
1024
LiquidCode/Migrations/20251026201212_Lot.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -1,145 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ContestSchedulingModes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "starts_at",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "ends_at",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "attempt_duration_minutes",
|
||||
table: "contests",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "available_from",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "available_until",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "schedule_type",
|
||||
table: "contests",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "active_attempt_expires_at",
|
||||
table: "contest_memberships",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "active_attempt_started_at",
|
||||
table: "contest_memberships",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "attempt_count",
|
||||
table: "contest_memberships",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_contests_available_from",
|
||||
table: "contests",
|
||||
column: "available_from");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_contests_available_until",
|
||||
table: "contests",
|
||||
column: "available_until");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_contests_available_from",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_contests_available_until",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "attempt_duration_minutes",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "available_from",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "available_until",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "schedule_type",
|
||||
table: "contests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "active_attempt_expires_at",
|
||||
table: "contest_memberships");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "active_attempt_started_at",
|
||||
table: "contest_memberships");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "attempt_count",
|
||||
table: "contest_memberships");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "starts_at",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "ends_at",
|
||||
table: "contests",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,84 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTesterStatusFields : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "amount_of_tests",
|
||||
table: "solutions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "callback_token",
|
||||
table: "solutions",
|
||||
type: "character varying(128)",
|
||||
maxLength: 128,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "current_test",
|
||||
table: "solutions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "testing_error_code",
|
||||
table: "solutions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "testing_message",
|
||||
table: "solutions",
|
||||
type: "character varying(512)",
|
||||
maxLength: 512,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "testing_state",
|
||||
table: "solutions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "amount_of_tests",
|
||||
table: "solutions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "callback_token",
|
||||
table: "solutions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "current_test",
|
||||
table: "solutions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "testing_error_code",
|
||||
table: "solutions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "testing_message",
|
||||
table: "solutions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "testing_state",
|
||||
table: "solutions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
[DbContext(typeof(LiquidDbContext))]
|
||||
[Migration("20251026203406_ContestSchedulingModes")]
|
||||
partial class ContestSchedulingModes
|
||||
[Migration("20251027192752_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -415,12 +415,6 @@ namespace LiquidCode.Migrations
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("S3ContentKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("s3content_key");
|
||||
|
||||
b.Property<string>("S3PrivateKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
@@ -449,52 +443,6 @@ namespace LiquidCode.Migrations
|
||||
b.ToTable("missions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMissionPublicTextData", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30000)
|
||||
.HasColumnType("character varying(30000)")
|
||||
.HasColumnName("data");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<int>("MissionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mission_id");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_missions_text_data");
|
||||
|
||||
b.HasIndex("Language")
|
||||
.HasDatabaseName("ix_missions_text_data_language");
|
||||
|
||||
b.HasIndex("MissionId", "Language")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_missions_text_data_mission_id_language");
|
||||
|
||||
b.ToTable("missions_text_data", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMissionTag", b =>
|
||||
{
|
||||
b.Property<int>("MissionId")
|
||||
@@ -578,10 +526,23 @@ namespace LiquidCode.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AmountOfTests")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("amount_of_tests");
|
||||
|
||||
b.Property<string>("CallbackToken")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("callback_token");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<int>("CurrentTest")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("current_test");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
@@ -610,6 +571,19 @@ namespace LiquidCode.Migrations
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int>("TestingErrorCode")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("testing_error_code");
|
||||
|
||||
b.Property<string>("TestingMessage")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("testing_message");
|
||||
|
||||
b.Property<int>("TestingState")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("testing_state");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("time");
|
||||
@@ -7,57 +7,11 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace LiquidCode.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Lot : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "contest_id",
|
||||
table: "user_submits",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "source_type",
|
||||
table: "user_submits",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "s3content_key",
|
||||
table: "missions",
|
||||
type: "character varying(256)",
|
||||
maxLength: 256,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "articles",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
author_id = table.Column<int>(type: "integer", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
s3content_key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_articles", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_articles_users_author_id",
|
||||
column: x => x.author_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "groups",
|
||||
columns: table => new
|
||||
@@ -93,6 +47,26 @@ namespace LiquidCode.Migrations
|
||||
table.PrimaryKey("pk_tags", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "users",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
username = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
pass_hash = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
salt = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_users", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contests",
|
||||
columns: table => new
|
||||
@@ -101,8 +75,12 @@ namespace LiquidCode.Migrations
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
description = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
|
||||
starts_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ends_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
schedule_type = table.Column<int>(type: "integer", nullable: false),
|
||||
starts_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
ends_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
available_from = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
available_until = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
attempt_duration_minutes = table.Column<int>(type: "integer", nullable: true),
|
||||
group_id = table.Column<int>(type: "integer", nullable: true),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
@@ -119,6 +97,31 @@ namespace LiquidCode.Migrations
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "articles",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
author_id = table.Column<int>(type: "integer", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
s3content_key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_articles", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_articles_users_author_id",
|
||||
column: x => x.author_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "group_memberships",
|
||||
columns: table => new
|
||||
@@ -146,6 +149,85 @@ namespace LiquidCode.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "missions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
author_id = table.Column<int>(type: "integer", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
s3private_key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
difficulty = table.Column<int>(type: "integer", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_missions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_missions_users_author_id",
|
||||
column: x => x.author_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "refresh_tokens",
|
||||
columns: table => new
|
||||
{
|
||||
token = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
db_user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
expires = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
os_name = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false),
|
||||
ip_address = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_refresh_tokens", x => x.token);
|
||||
table.ForeignKey(
|
||||
name: "fk_refresh_tokens_users_db_user_id",
|
||||
column: x => x.db_user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contest_memberships",
|
||||
columns: table => new
|
||||
{
|
||||
contest_id = table.Column<int>(type: "integer", nullable: false),
|
||||
user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
role = table.Column<int>(type: "integer", nullable: false),
|
||||
active_attempt_started_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
active_attempt_expires_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
attempt_count = table.Column<int>(type: "integer", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_contest_memberships", x => new { x.contest_id, x.user_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_contest_memberships_contests_contest_id",
|
||||
column: x => x.contest_id,
|
||||
principalTable: "contests",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_contest_memberships_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "article_tags",
|
||||
columns: table => new
|
||||
@@ -172,32 +254,6 @@ namespace LiquidCode.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "mission_tags",
|
||||
columns: table => new
|
||||
{
|
||||
mission_id = table.Column<int>(type: "integer", nullable: false),
|
||||
tag_id = table.Column<int>(type: "integer", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_mission_tags", x => new { x.mission_id, x.tag_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_mission_tags_missions_mission_id",
|
||||
column: x => x.mission_id,
|
||||
principalTable: "missions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_mission_tags_tags_tag_id",
|
||||
column: x => x.tag_id,
|
||||
principalTable: "tags",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contest_articles",
|
||||
columns: table => new
|
||||
@@ -225,33 +281,6 @@ namespace LiquidCode.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contest_memberships",
|
||||
columns: table => new
|
||||
{
|
||||
contest_id = table.Column<int>(type: "integer", nullable: false),
|
||||
user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
role = table.Column<int>(type: "integer", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_contest_memberships", x => new { x.contest_id, x.user_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_contest_memberships_contests_contest_id",
|
||||
column: x => x.contest_id,
|
||||
principalTable: "contests",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_contest_memberships_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contest_missions",
|
||||
columns: table => new
|
||||
@@ -279,10 +308,100 @@ namespace LiquidCode.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_contest_id",
|
||||
table: "user_submits",
|
||||
column: "contest_id");
|
||||
migrationBuilder.CreateTable(
|
||||
name: "mission_tags",
|
||||
columns: table => new
|
||||
{
|
||||
mission_id = table.Column<int>(type: "integer", nullable: false),
|
||||
tag_id = table.Column<int>(type: "integer", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_mission_tags", x => new { x.mission_id, x.tag_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_mission_tags_missions_mission_id",
|
||||
column: x => x.mission_id,
|
||||
principalTable: "missions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_mission_tags_tags_tag_id",
|
||||
column: x => x.tag_id,
|
||||
principalTable: "tags",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "solutions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
mission_id = table.Column<int>(type: "integer", nullable: false),
|
||||
language = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: false),
|
||||
language_version = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: false),
|
||||
source_code = table.Column<string>(type: "character varying(10000)", maxLength: 10000, nullable: false),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
testing_state = table.Column<int>(type: "integer", nullable: false),
|
||||
testing_error_code = table.Column<int>(type: "integer", nullable: false),
|
||||
testing_message = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true),
|
||||
current_test = table.Column<int>(type: "integer", nullable: false),
|
||||
amount_of_tests = table.Column<int>(type: "integer", nullable: false),
|
||||
callback_token = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||
time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_solutions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_solutions_missions_mission_id",
|
||||
column: x => x.mission_id,
|
||||
principalTable: "missions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_submits",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
user_id = table.Column<int>(type: "integer", nullable: false),
|
||||
solution_id = table.Column<int>(type: "integer", nullable: false),
|
||||
contest_id = table.Column<int>(type: "integer", nullable: true),
|
||||
source_type = table.Column<int>(type: "integer", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_user_submits", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_submits_contests_contest_id",
|
||||
column: x => x.contest_id,
|
||||
principalTable: "contests",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_user_submits_solutions_solution_id",
|
||||
column: x => x.solution_id,
|
||||
principalTable: "solutions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_submits_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_article_tags_tag_id",
|
||||
@@ -319,6 +438,16 @@ namespace LiquidCode.Migrations
|
||||
table: "contest_missions",
|
||||
column: "mission_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_contests_available_from",
|
||||
table: "contests",
|
||||
column: "available_from");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_contests_available_until",
|
||||
table: "contests",
|
||||
column: "available_until");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_contests_ends_at",
|
||||
table: "contests",
|
||||
@@ -359,6 +488,51 @@ namespace LiquidCode.Migrations
|
||||
table: "mission_tags",
|
||||
column: "tag_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_author_id",
|
||||
table: "missions",
|
||||
column: "author_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_created_at",
|
||||
table: "missions",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_difficulty",
|
||||
table: "missions",
|
||||
column: "difficulty");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_missions_is_deleted",
|
||||
table: "missions",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_refresh_tokens_db_user_id",
|
||||
table: "refresh_tokens",
|
||||
column: "db_user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_refresh_tokens_expires",
|
||||
table: "refresh_tokens",
|
||||
column: "expires");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_created_at",
|
||||
table: "solutions",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_mission_id",
|
||||
table: "solutions",
|
||||
column: "mission_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_solutions_status",
|
||||
table: "solutions",
|
||||
column: "status");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tags_is_deleted",
|
||||
table: "tags",
|
||||
@@ -370,21 +544,51 @@ namespace LiquidCode.Migrations
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_user_submits_contests_contest_id",
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_contest_id",
|
||||
table: "user_submits",
|
||||
column: "contest_id",
|
||||
principalTable: "contests",
|
||||
principalColumn: "id");
|
||||
column: "contest_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_created_at",
|
||||
table: "user_submits",
|
||||
column: "created_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_is_deleted",
|
||||
table: "user_submits",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_solution_id",
|
||||
table: "user_submits",
|
||||
column: "solution_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_submits_user_id",
|
||||
table: "user_submits",
|
||||
column: "user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_email",
|
||||
table: "users",
|
||||
column: "email");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_is_deleted",
|
||||
table: "users",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_username",
|
||||
table: "users",
|
||||
column: "username",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_user_submits_contests_contest_id",
|
||||
table: "user_submits");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "article_tags");
|
||||
|
||||
@@ -404,32 +608,31 @@ namespace LiquidCode.Migrations
|
||||
name: "mission_tags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "articles");
|
||||
name: "refresh_tokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "contests");
|
||||
name: "user_submits");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "articles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "contests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "solutions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "groups");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_user_submits_contest_id",
|
||||
table: "user_submits");
|
||||
migrationBuilder.DropTable(
|
||||
name: "missions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "contest_id",
|
||||
table: "user_submits");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "source_type",
|
||||
table: "user_submits");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "s3content_key",
|
||||
table: "missions");
|
||||
migrationBuilder.DropTable(
|
||||
name: "users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,12 +412,6 @@ namespace LiquidCode.Migrations
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("S3ContentKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("s3content_key");
|
||||
|
||||
b.Property<string>("S3PrivateKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
@@ -446,52 +440,6 @@ namespace LiquidCode.Migrations
|
||||
b.ToTable("missions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMissionPublicTextData", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30000)
|
||||
.HasColumnType("character varying(30000)")
|
||||
.HasColumnName("data");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<int>("MissionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("mission_id");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_missions_text_data");
|
||||
|
||||
b.HasIndex("Language")
|
||||
.HasDatabaseName("ix_missions_text_data_language");
|
||||
|
||||
b.HasIndex("MissionId", "Language")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_missions_text_data_mission_id_language");
|
||||
|
||||
b.ToTable("missions_text_data", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiquidCode.Infrastructure.Database.Entities.DbMissionTag", b =>
|
||||
{
|
||||
b.Property<int>("MissionId")
|
||||
|
||||
Reference in New Issue
Block a user