Update db migrations with new objects and fields

This commit is contained in:
Tech Garage 2024-01-25 20:34:54 +03:30
parent 115f657738
commit 24c99bf691
17 changed files with 1450 additions and 0 deletions

View file

@ -0,0 +1,91 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20230906130735_AddDataUsage")]
partial class AddDataUsage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,61 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class AddDataUsage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "RX",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "TX",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "DataUsages",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserID = table.Column<int>(type: "INTEGER", nullable: false),
RX = table.Column<int>(type: "INTEGER", nullable: false),
TX = table.Column<int>(type: "INTEGER", nullable: false),
UserReset = table.Column<bool>(type: "INTEGER", nullable: false),
CreationTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DataUsages", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DataUsages");
migrationBuilder.DropColumn(
name: "RX",
table: "Users");
migrationBuilder.DropColumn(
name: "TX",
table: "Users");
}
}
}

View file

@ -0,0 +1,118 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231010194742_AddLastKnownTraffic")]
partial class AddLastKnownTraffic
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("SystemReset")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,59 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class AddLastKnownTraffic : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ResetNotes",
table: "DataUsages",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<bool>(
name: "SystemReset",
table: "DataUsages",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "LastKnownTraffic",
columns: table => new
{
UserID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RX = table.Column<int>(type: "INTEGER", nullable: false),
TX = table.Column<int>(type: "INTEGER", nullable: false),
CreationTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LastKnownTraffic", x => x.UserID);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LastKnownTraffic");
migrationBuilder.DropColumn(
name: "ResetNotes",
table: "DataUsages");
migrationBuilder.DropColumn(
name: "SystemReset",
table: "DataUsages");
}
}
}

View file

@ -0,0 +1,117 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231010204040_FixDataUsage")]
partial class FixDataUsage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<bool>("SystemReset")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class FixDataUsage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ResetNotes",
table: "DataUsages",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ResetNotes",
table: "DataUsages",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
}
}
}

View file

@ -0,0 +1,117 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231028171348_UserTrafficLimit")]
partial class UserTrafficLimit
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class UserTrafficLimit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SystemReset",
table: "DataUsages");
migrationBuilder.AddColumn<int>(
name: "TrafficLimit",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TrafficLimit",
table: "Users");
migrationBuilder.AddColumn<bool>(
name: "SystemReset",
table: "DataUsages",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
}
}

View file

@ -0,0 +1,126 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231124145201_DNS")]
partial class DNS
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("InheritIP")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class DNS : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DNSAddress",
table: "Users",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "InheritDNS",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "InheritIP",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DNSAddress",
table: "Users");
migrationBuilder.DropColumn(
name: "InheritDNS",
table: "Users");
migrationBuilder.DropColumn(
name: "InheritIP",
table: "Users");
}
}
}

View file

@ -0,0 +1,146 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231224201158_AddServersTable")]
partial class AddServersTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("InheritIP")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGServerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<int>("IPPoolId")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Servers");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class AddServersTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Servers",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DNSAddress = table.Column<string>(type: "TEXT", nullable: true),
InheritDNS = table.Column<bool>(type: "INTEGER", nullable: false),
IPPoolId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Servers", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Servers");
}
}
}

View file

@ -0,0 +1,149 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231226193659_FixServerPoolUsage")]
partial class FixServerPoolUsage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("InheritIP")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGServerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<int>("IPPoolId")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("UseIPPool")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Servers");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class FixServerPoolUsage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseIPPool",
table: "Servers",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseIPPool",
table: "Servers");
}
}
}

View file

@ -0,0 +1,149 @@
// <auto-generated />
using System;
using MTWireGuard.Application;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
[DbContext(typeof(DBContext))]
[Migration("20231229181318_FixServerNullables")]
partial class FixServerNullables
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("InheritIP")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("PrivateKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PublicKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
.IsUnique();
b.HasIndex("PublicKey")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGServerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<int?>("IPPoolId")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("UseIPPool")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Servers");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWireGuard.Application.Migrations
{
/// <inheritdoc />
public partial class FixServerNullables : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "IPPoolId",
table: "Servers",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "IPPoolId",
table: "Servers",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}

View file

@ -17,18 +17,76 @@ namespace MTWireGuard.Application.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("MTWireGuard.Application.Models.DataUsage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<string>("ResetNotes")
.HasColumnType("TEXT");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("UserID")
.HasColumnType("INTEGER");
b.Property<bool>("UserReset")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("DataUsages");
});
modelBuilder.Entity("MTWireGuard.Application.Models.LastKnownTraffic", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.HasKey("UserID");
b.ToTable("LastKnownTraffic");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGPeerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<DateTime?>("Expire")
.HasColumnType("TEXT");
b.Property<int?>("ExpireID")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("InheritIP")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
@ -40,6 +98,15 @@ namespace MTWireGuard.Application.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("RX")
.HasColumnType("INTEGER");
b.Property<int>("TX")
.HasColumnType("INTEGER");
b.Property<int>("TrafficLimit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PrivateKey")
@ -50,6 +117,29 @@ namespace MTWireGuard.Application.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("MTWireGuard.Application.Models.Mikrotik.WGServerDBModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("DNSAddress")
.HasColumnType("TEXT");
b.Property<int?>("IPPoolId")
.HasColumnType("INTEGER");
b.Property<bool>("InheritDNS")
.HasColumnType("INTEGER");
b.Property<bool>("UseIPPool")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Servers");
});
#pragma warning restore 612, 618
}
}