diff --git a/TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.Designer.cs b/TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.Designer.cs similarity index 68% rename from TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.Designer.cs rename to TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.Designer.cs index 2837705..60677cc 100644 --- a/TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.Designer.cs +++ b/TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.Designer.cs @@ -2,7 +2,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using TwilioSMSReceiver.Data; @@ -12,31 +11,25 @@ using TwilioSMSReceiver.Data; namespace TwilioSMSReceiver.Data.Migrations { [DbContext(typeof(SMSDbCtx))] - [Migration("20211231074942_InitialMigration")] + [Migration("20220104193753_InitialMigration")] partial class InitialMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.1") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.HasAnnotation("ProductVersion", "6.0.1"); modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("OriginalMMSData") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("SMSModelId") - .HasColumnType("int"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -49,12 +42,10 @@ namespace TwilioSMSReceiver.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("WebHookUri") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -65,26 +56,24 @@ namespace TwilioSMSReceiver.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("IsForwardedYet") - .HasColumnType("bit"); + .HasColumnType("INTEGER"); b.Property("MessageContents") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("ReceivedNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("SenderNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("TimeReceived") - .HasColumnType("datetime2"); + .HasColumnType("TEXT"); b.HasKey("Id"); diff --git a/TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.cs b/TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.cs similarity index 71% rename from TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.cs rename to TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.cs index 2a16272..965a97b 100644 --- a/TwilioSMSReceiver.Data/Migrations/20211231074942_InitialMigration.cs +++ b/TwilioSMSReceiver.Data/Migrations/20220104193753_InitialMigration.cs @@ -13,9 +13,9 @@ namespace TwilioSMSReceiver.Data.Migrations name: "MSTeamsWebHooks", columns: table => new { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - WebHookUri = table.Column(type: "nvarchar(max)", nullable: true) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + WebHookUri = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -26,13 +26,13 @@ namespace TwilioSMSReceiver.Data.Migrations name: "SMSMessages", columns: table => new { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ReceivedNumber = table.Column(type: "nvarchar(max)", nullable: false), - SenderNumber = table.Column(type: "nvarchar(max)", nullable: false), - TimeReceived = table.Column(type: "datetime2", nullable: false), - MessageContents = table.Column(type: "nvarchar(max)", nullable: true), - IsForwardedYet = table.Column(type: "bit", nullable: false) + 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 => { @@ -43,10 +43,10 @@ namespace TwilioSMSReceiver.Data.Migrations name: "MMSMessages", columns: table => new { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - SMSModelId = table.Column(type: "int", nullable: false), - OriginalMMSData = table.Column(type: "nvarchar(max)", nullable: true) + 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 => { diff --git a/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs b/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs index 7359294..7017746 100644 --- a/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs +++ b/TwilioSMSReceiver.Data/Migrations/SMSDbCtxModelSnapshot.cs @@ -2,7 +2,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using TwilioSMSReceiver.Data; @@ -16,25 +15,19 @@ namespace TwilioSMSReceiver.Data.Migrations protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.1") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.HasAnnotation("ProductVersion", "6.0.1"); modelBuilder.Entity("TwilioSMSReceiver.Data.Models.MMSModel", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("OriginalMMSData") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("SMSModelId") - .HasColumnType("int"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -47,12 +40,10 @@ namespace TwilioSMSReceiver.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("WebHookUri") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -63,26 +54,24 @@ namespace TwilioSMSReceiver.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + .HasColumnType("INTEGER"); b.Property("IsForwardedYet") - .HasColumnType("bit"); + .HasColumnType("INTEGER"); b.Property("MessageContents") - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("ReceivedNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("SenderNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("TEXT"); b.Property("TimeReceived") - .HasColumnType("datetime2"); + .HasColumnType("TEXT"); b.HasKey("Id"); diff --git a/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj b/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj index 85022c5..763dc57 100644 --- a/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj +++ b/TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj @@ -11,8 +11,4 @@ - - - - diff --git a/TwilioSMSReceiver/Program.cs b/TwilioSMSReceiver/Program.cs index c6d4e6e..b08d525 100644 --- a/TwilioSMSReceiver/Program.cs +++ b/TwilioSMSReceiver/Program.cs @@ -15,7 +15,7 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddDbContext(options => { - options.UseSqlServer(builder.Configuration.GetConnectionString("SmsDBCtx")); + options.UseSqlite(builder.Configuration.GetConnectionString("SmsDBCtx")); }); builder.Services.RegisterSMSExtensions(); builder.Services.AddLogging(); diff --git a/TwilioSMSReceiver/appsettings.json b/TwilioSMSReceiver/appsettings.json index bd4fd1d..22b7a72 100644 --- a/TwilioSMSReceiver/appsettings.json +++ b/TwilioSMSReceiver/appsettings.json @@ -6,7 +6,7 @@ } }, "ConnectionStrings": { - "SmsDbCtx": "Server=(localdb)\\mssqllocaldb;Database=SMSDB;Trusted_Connection=True;" + "SmsDbCtx": "Data Source=smsdatabase.sqlite" }, "AllowedHosts": "*" }