Add migrations for the made models

This commit is contained in:
Daniel_I_Am 2020-08-04 23:40:32 +02:00
parent ca10f50645
commit 5604d0132d
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
15 changed files with 640 additions and 0 deletions

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804195804_LodestoneCharacter")]
partial class LodestoneCharacter
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class LodestoneCharacter : Migration
{
private const string Table = "LodestoneCharacter";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
LodestoneId = table.Column<ulong>(nullable: false),
DiscordUserId = table.Column<ulong>(nullable: false),
DiscordGuildId = table.Column<ulong>(nullable: false),
Name = table.Column<string>(nullable: false),
Avatar = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CharacterAndGuild", x => new {x.DiscordGuildId, x.LodestoneId});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804202834_LodestoneFreeCompany")]
partial class LodestoneFreeCompany
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class LodestoneFreeCompany : Migration
{
private const string Table = "LodestoneFreeCompany";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
LodestoneId = table.Column<ulong>(nullable: false),
DiscordGuildId = table.Column<ulong>(nullable: false),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FCAndGuild", x => new {x.DiscordGuildId, x.LodestoneId});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804203214_Points")]
partial class Points
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class Points : Migration
{
private const string Table = "Points";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
DiscordUserId = table.Column<ulong>(nullable: false),
DiscordGuildId = table.Column<ulong>(nullable: false),
Amount = table.Column<ulong>(nullable: false, defaultValue: 0)
},
constraints: table =>
{
table.PrimaryKey("PK_UserAndServer", x => new {x.DiscordUserId, x.DiscordGuildId});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804204404_Raffles")]
partial class Raffles
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class Raffles : Migration
{
private const string Table = "Raffles";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
Id = table.Column<ulong>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DiscordUserId = table.Column<ulong>(nullable: false),
DiscordGuildId = table.Column<ulong>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ID", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804204734_CommandPermissions")]
partial class CommandPermissions
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class CommandPermissions : Migration
{
private const string Table = "CommandPermissions";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
Id = table.Column<ulong>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DiscordGuildId = table.Column<ulong>(nullable: false),
TargetId = table.Column<ulong>(nullable: false),
TargetType = table.Column<PermissionTarget>(nullable: false),
Command = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ID", x => x.Id);
table.UniqueConstraint("UK_OneCommandPerTargetOnGuild", x => new {x.DiscordGuildId, x.TargetType, x.TargetId, x.Command});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
public enum PermissionTarget
{
User,
Role
}
}

View File

@ -0,0 +1,23 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804205955_Configuration")]
partial class Configuration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class Configuration : Migration
{
private const string Table = "Configuration";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
DiscordGuildId = table.Column<ulong>(nullable: false),
Key = table.Column<string>(nullable: false, maxLength: 128),
SerializedValue = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_KeyOnGuild", x => new {x.DiscordGuildId, x.Key});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,139 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
[Migration("20200804213001_ExperiencePoints")]
partial class ExperiencePoints
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("ChaosBot.Models.CommandPermission", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Command")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("TargetId")
.HasColumnType("bigint unsigned");
b.Property<int>("TargetType")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("CommandPermissions");
});
modelBuilder.Entity("ChaosBot.Models.Configuration", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<string>("Key")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("SerializedValue")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "Key");
b.ToTable("Configuration");
});
modelBuilder.Entity("ChaosBot.Models.LodestoneCharacter", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("LodestoneId")
.HasColumnType("bigint unsigned");
b.Property<string>("Avatar")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "LodestoneId");
b.ToTable("LodestoneCharacter");
});
modelBuilder.Entity("ChaosBot.Models.LodestoneFreeCompany", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("LodestoneId")
.HasColumnType("bigint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "LodestoneId");
b.ToTable("LodestoneFreeCompany");
});
modelBuilder.Entity("ChaosBot.Models.Point", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Amount")
.HasColumnType("bigint unsigned");
b.HasKey("DiscordGuildId", "DiscordUserId");
b.ToTable("Points");
});
modelBuilder.Entity("ChaosBot.Models.Raffle", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Raffles");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ChaosBot.Migrations
{
public partial class ExperiencePoints : Migration
{
private const string Table = "ExperiencePoints";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: Table,
columns: table => new
{
DiscordGuildId = table.Column<ulong>(nullable: false),
DiscordUserId = table.Column<ulong>(nullable: false),
Amount = table.Column<ulong>(nullable: false, defaultValue: 0)
},
constraints: table =>
{
table.PrimaryKey("PK_UserAndGuild", x => new {x.DiscordUserId, x.DiscordGuildId});
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(Table);
}
}
}

View File

@ -0,0 +1,137 @@
// <auto-generated />
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ChaosBot.Migrations
{
[DbContext(typeof(ChaosbotContext))]
partial class ChaosbotContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("ChaosBot.Models.CommandPermission", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Command")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("TargetId")
.HasColumnType("bigint unsigned");
b.Property<int>("TargetType")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("CommandPermissions");
});
modelBuilder.Entity("ChaosBot.Models.Configuration", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<string>("Key")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("SerializedValue")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "Key");
b.ToTable("Configuration");
});
modelBuilder.Entity("ChaosBot.Models.LodestoneCharacter", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("LodestoneId")
.HasColumnType("bigint unsigned");
b.Property<string>("Avatar")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "LodestoneId");
b.ToTable("LodestoneCharacter");
});
modelBuilder.Entity("ChaosBot.Models.LodestoneFreeCompany", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("LodestoneId")
.HasColumnType("bigint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("DiscordGuildId", "LodestoneId");
b.ToTable("LodestoneFreeCompany");
});
modelBuilder.Entity("ChaosBot.Models.Point", b =>
{
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Amount")
.HasColumnType("bigint unsigned");
b.HasKey("DiscordGuildId", "DiscordUserId");
b.ToTable("Points");
});
modelBuilder.Entity("ChaosBot.Models.Raffle", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("DiscordUserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Raffles");
});
#pragma warning restore 612, 618
}
}
}