From c1b0d88b4c6139339a36606423c99bb0752f676e Mon Sep 17 00:00:00 2001 From: Jeff Leung Date: Tue, 28 Dec 2021 19:43:13 -0800 Subject: [PATCH] Finalize the new migration --- ...9034231_InitialMigrationSQLite.Designer.cs | 101 ++++++++++++++++++ .../20211229034231_InitialMigrationSQLite.cs | 80 ++++++++++++++ .../Migrations/SMSDbCtxModelSnapshot.cs | 99 +++++++++++++++++ .../TwilioSMSReceiver.Data.csproj | 1 + 4 files changed, 281 insertions(+) create mode 100644 TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.Designer.cs create mode 100644 TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.cs create mode 100644 TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs diff --git a/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.Designer.cs b/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.Designer.cs new file mode 100644 index 0000000..53c2a31 --- /dev/null +++ b/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.Designer.cs @@ -0,0 +1,101 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("OriginalMMSData") + .HasColumnType("TEXT"); + + b.Property("SMSModelId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("SMSModelId"); + + b.ToTable("MMSMessages"); + }); + + modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MSTeamsWebHook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("WebHookUri") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("MSTeamsWebHooks"); + }); + + modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("IsForwardedYet") + .HasColumnType("INTEGER"); + + b.Property("MessageContents") + .HasColumnType("TEXT"); + + b.Property("ReceivedNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SenderNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("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 + } + } +} diff --git a/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.cs b/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.cs new file mode 100644 index 0000000..20b11df --- /dev/null +++ b/TwilioSMSReceiver.Data/Migrations/20211229034231_InitialMigrationSQLite.cs @@ -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(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + WebHookUri = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MSTeamsWebHooks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "SMSMessages", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ReceivedNumber = table.Column(type: "TEXT", nullable: false), + SenderNumber = table.Column(type: "TEXT", nullable: false), + TimeReceived = table.Column(type: "TEXT", nullable: false), + MessageContents = table.Column(type: "TEXT", nullable: true), + IsForwardedYet = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SMSMessages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MMSMessages", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + SMSModelId = table.Column(type: "INTEGER", nullable: false), + OriginalMMSData = table.Column(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"); + } + } +} diff --git a/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs b/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs new file mode 100644 index 0000000..7017746 --- /dev/null +++ b/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs @@ -0,0 +1,99 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("OriginalMMSData") + .HasColumnType("TEXT"); + + b.Property("SMSModelId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("SMSModelId"); + + b.ToTable("MMSMessages"); + }); + + modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MSTeamsWebHook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("WebHookUri") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("MSTeamsWebHooks"); + }); + + modelBuilder.Entity("TwilioSMSReceiver.Data.Models.SMSModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("IsForwardedYet") + .HasColumnType("INTEGER"); + + b.Property("MessageContents") + .HasColumnType("TEXT"); + + b.Property("ReceivedNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SenderNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("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 + } + } +} diff --git a/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj b/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj index f1c0551..cddbcf0 100644 --- a/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj +++ b/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj @@ -7,6 +7,7 @@ +