Finalize the new migration

This commit is contained in:
Jeff Leung 2021-12-28 19:43:13 -08:00
parent 6aba9675e5
commit c1b0d88b4c
4 changed files with 281 additions and 0 deletions

View File

@ -0,0 +1,101 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TwilioSMSReceiver.Data;
#nullable disable
namespace TwilioSMSReceiver.Data.Migrations
{
[DbContext(typeof(SMSDbCtx))]
[Migration("20211229034231_InitialMigrationSQLite")]
partial class InitialMigrationSQLite
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.1");
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("OriginalMMSData")
.HasColumnType("TEXT");
b.Property<int>("SMSModelId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SMSModelId");
b.ToTable("MMSMessages");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MSTeamsWebHook", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("WebHookUri")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("MSTeamsWebHooks");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsForwardedYet")
.HasColumnType("INTEGER");
b.Property<string>("MessageContents")
.HasColumnType("TEXT");
b.Property<string>("ReceivedNumber")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SenderNumber")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("TimeReceived")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("SMSMessages");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b =>
{
b.HasOne("TwilioSMSReceiver.Data.Models.SMSModel", "ParentSMSMessage")
.WithMany("MMSContent")
.HasForeignKey("SMSModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentSMSMessage");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b =>
{
b.Navigation("MMSContent");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,80 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TwilioSMSReceiver.Data.Migrations
{
public partial class InitialMigrationSQLite : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MSTeamsWebHooks",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
WebHookUri = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MSTeamsWebHooks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SMSMessages",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ReceivedNumber = table.Column<string>(type: "TEXT", nullable: false),
SenderNumber = table.Column<string>(type: "TEXT", nullable: false),
TimeReceived = table.Column<DateTime>(type: "TEXT", nullable: false),
MessageContents = table.Column<string>(type: "TEXT", nullable: true),
IsForwardedYet = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SMSMessages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "MMSMessages",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SMSModelId = table.Column<int>(type: "INTEGER", nullable: false),
OriginalMMSData = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MMSMessages", x => x.Id);
table.ForeignKey(
name: "FK_MMSMessages_SMSMessages_SMSModelId",
column: x => x.SMSModelId,
principalTable: "SMSMessages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_MMSMessages_SMSModelId",
table: "MMSMessages",
column: "SMSModelId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "MMSMessages");
migrationBuilder.DropTable(
name: "MSTeamsWebHooks");
migrationBuilder.DropTable(
name: "SMSMessages");
}
}
}

View File

@ -0,0 +1,99 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TwilioSMSReceiver.Data;
#nullable disable
namespace TwilioSMSReceiver.Data.Migrations
{
[DbContext(typeof(SMSDbCtx))]
partial class SMSDbCtxModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.1");
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("OriginalMMSData")
.HasColumnType("TEXT");
b.Property<int>("SMSModelId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SMSModelId");
b.ToTable("MMSMessages");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MSTeamsWebHook", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("WebHookUri")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("MSTeamsWebHooks");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsForwardedYet")
.HasColumnType("INTEGER");
b.Property<string>("MessageContents")
.HasColumnType("TEXT");
b.Property<string>("ReceivedNumber")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SenderNumber")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("TimeReceived")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("SMSMessages");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b =>
{
b.HasOne("TwilioSMSReceiver.Data.Models.SMSModel", "ParentSMSMessage")
.WithMany("MMSContent")
.HasForeignKey("SMSModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentSMSMessage");
});
modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b =>
{
b.Navigation("MMSContent");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -7,6 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>