From 1df2254f68ba79ac9fab0570631ed439e1327354 Mon Sep 17 00:00:00 2001 From: radioActive DROID Date: Sat, 18 Nov 2023 19:18:21 +0100 Subject: [PATCH 1/3] added efcore initial migration --- .../20230606124455_Initial.Designer.cs | 166 ++++++++++++++++++ .../Migrations/20230606124455_Initial.cs | 130 ++++++++++++++ .../Migrations/ServiceContextModelSnapshot.cs | 163 +++++++++++++++++ 3 files changed, 459 insertions(+) create mode 100644 samples/aspnet-sample/Migrations/20230606124455_Initial.Designer.cs create mode 100644 samples/aspnet-sample/Migrations/20230606124455_Initial.cs create mode 100644 samples/aspnet-sample/Migrations/ServiceContextModelSnapshot.cs diff --git a/samples/aspnet-sample/Migrations/20230606124455_Initial.Designer.cs b/samples/aspnet-sample/Migrations/20230606124455_Initial.Designer.cs new file mode 100644 index 0000000..383c59d --- /dev/null +++ b/samples/aspnet-sample/Migrations/20230606124455_Initial.Designer.cs @@ -0,0 +1,166 @@ +// +using System; +using Axolotl.AspNetSample.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Axolotl.AspNetSample.Migrations +{ + [DbContext(typeof(ServiceContext))] + [Migration("20230606124455_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.0-preview.4.23259.3"); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.CategoryModule.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("CreatedAt") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("INTEGER"); + + b.Property("DeletedBy") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("INTEGER"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DeletedAt"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.PostModule.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("CategoryId") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("INTEGER"); + + b.Property("DeletedBy") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("INTEGER"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("DeletedAt"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.TagModule.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("PostTag", b => + { + b.Property("PostsId") + .HasColumnType("TEXT"); + + b.Property("TagsId") + .HasColumnType("TEXT"); + + b.HasKey("PostsId", "TagsId"); + + b.HasIndex("TagsId"); + + b.ToTable("PostTag"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.PostModule.Post", b => + { + b.HasOne("Axolotl.AspNetSample.Features.CategoryModule.Category", "Category") + .WithMany("Posts") + .HasForeignKey("CategoryId"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("PostTag", b => + { + b.HasOne("Axolotl.AspNetSample.Features.PostModule.Post", null) + .WithMany() + .HasForeignKey("PostsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Axolotl.AspNetSample.Features.TagModule.Tag", null) + .WithMany() + .HasForeignKey("TagsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.CategoryModule.Category", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/aspnet-sample/Migrations/20230606124455_Initial.cs b/samples/aspnet-sample/Migrations/20230606124455_Initial.cs new file mode 100644 index 0000000..2a88605 --- /dev/null +++ b/samples/aspnet-sample/Migrations/20230606124455_Initial.cs @@ -0,0 +1,130 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Axolotl.AspNetSample.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Categories", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + CreatedBy = table.Column(type: "TEXT", nullable: false), + CreatedAt = table.Column(type: "INTEGER", nullable: false), + UpdatedBy = table.Column(type: "TEXT", nullable: false), + UpdatedAt = table.Column(type: "INTEGER", nullable: true), + DeletedBy = table.Column(type: "TEXT", nullable: false), + DeletedAt = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Categories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Tags", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Posts", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Title = table.Column(type: "TEXT", nullable: false), + Content = table.Column(type: "TEXT", nullable: false), + CategoryId = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", nullable: false), + CreatedAt = table.Column(type: "INTEGER", nullable: false), + UpdatedBy = table.Column(type: "TEXT", nullable: false), + UpdatedAt = table.Column(type: "INTEGER", nullable: true), + DeletedBy = table.Column(type: "TEXT", nullable: false), + DeletedAt = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Posts", x => x.Id); + table.ForeignKey( + name: "FK_Posts_Categories_CategoryId", + column: x => x.CategoryId, + principalTable: "Categories", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "PostTag", + columns: table => new + { + PostsId = table.Column(type: "TEXT", nullable: false), + TagsId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PostTag", x => new { x.PostsId, x.TagsId }); + table.ForeignKey( + name: "FK_PostTag_Posts_PostsId", + column: x => x.PostsId, + principalTable: "Posts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PostTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Categories_DeletedAt", + table: "Categories", + column: "DeletedAt"); + + migrationBuilder.CreateIndex( + name: "IX_PostTag_TagsId", + table: "PostTag", + column: "TagsId"); + + migrationBuilder.CreateIndex( + name: "IX_Posts_CategoryId", + table: "Posts", + column: "CategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Posts_DeletedAt", + table: "Posts", + column: "DeletedAt"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PostTag"); + + migrationBuilder.DropTable( + name: "Posts"); + + migrationBuilder.DropTable( + name: "Tags"); + + migrationBuilder.DropTable( + name: "Categories"); + } + } +} diff --git a/samples/aspnet-sample/Migrations/ServiceContextModelSnapshot.cs b/samples/aspnet-sample/Migrations/ServiceContextModelSnapshot.cs new file mode 100644 index 0000000..9d265f0 --- /dev/null +++ b/samples/aspnet-sample/Migrations/ServiceContextModelSnapshot.cs @@ -0,0 +1,163 @@ +// +using System; +using Axolotl.AspNetSample.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Axolotl.AspNetSample.Migrations +{ + [DbContext(typeof(ServiceContext))] + partial class ServiceContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.0-preview.4.23259.3"); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.CategoryModule.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("CreatedAt") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("INTEGER"); + + b.Property("DeletedBy") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("INTEGER"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DeletedAt"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.PostModule.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("CategoryId") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("INTEGER"); + + b.Property("DeletedBy") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("INTEGER"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("DeletedAt"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.TagModule.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("PostTag", b => + { + b.Property("PostsId") + .HasColumnType("TEXT"); + + b.Property("TagsId") + .HasColumnType("TEXT"); + + b.HasKey("PostsId", "TagsId"); + + b.HasIndex("TagsId"); + + b.ToTable("PostTag"); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.PostModule.Post", b => + { + b.HasOne("Axolotl.AspNetSample.Features.CategoryModule.Category", "Category") + .WithMany("Posts") + .HasForeignKey("CategoryId"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("PostTag", b => + { + b.HasOne("Axolotl.AspNetSample.Features.PostModule.Post", null) + .WithMany() + .HasForeignKey("PostsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Axolotl.AspNetSample.Features.TagModule.Tag", null) + .WithMany() + .HasForeignKey("TagsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Axolotl.AspNetSample.Features.CategoryModule.Category", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} From 2f5803be565c641dec36a4643cf616d61802f815 Mon Sep 17 00:00:00 2001 From: radioActive DROID Date: Sat, 18 Nov 2023 19:18:34 +0100 Subject: [PATCH 2/3] Update Axolotl.sln.DotSettings --- Axolotl.sln.DotSettings | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Axolotl.sln.DotSettings b/Axolotl.sln.DotSettings index 35719c1..b5aa85a 100644 --- a/Axolotl.sln.DotSettings +++ b/Axolotl.sln.DotSettings @@ -1,5 +1,5 @@  - Copyright 2022 - $CURRENT_YEAR$ Godwin peter .O (me@godwin.dev) + Copyright 2022 - $CurrentDate.Year Godwin peter .O (me@godwin.dev) Licensed under the MIT License; you may not use this file except in compliance with the License. @@ -7,4 +7,5 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. + True \ No newline at end of file From 2c05844334971067aa8094899492d0a992b36764 Mon Sep 17 00:00:00 2001 From: radioActive DROID Date: Sat, 18 Nov 2023 19:21:48 +0100 Subject: [PATCH 3/3] enable trimming for Axolotl --- Directory.Build.props | 1 + src/aspnet/Axolotl.AspNet.csproj | 12 +++--------- src/efcore/Axolotl.EFCore.csproj | 6 ++---- src/http/Axolotl.Http.csproj | 1 + src/razor/Axolotl.Razor.csproj | 6 ++---- src/standard/Axolotl.csproj | 1 + 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index ef54aea..3699811 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,6 +23,7 @@ true true icon.jpg + true diff --git a/src/aspnet/Axolotl.AspNet.csproj b/src/aspnet/Axolotl.AspNet.csproj index 2958bad..490291f 100644 --- a/src/aspnet/Axolotl.AspNet.csproj +++ b/src/aspnet/Axolotl.AspNet.csproj @@ -12,10 +12,10 @@ + Axolotl.AspNet - - - + + @@ -25,13 +25,7 @@ - - - - - - diff --git a/src/efcore/Axolotl.EFCore.csproj b/src/efcore/Axolotl.EFCore.csproj index e86f9da..f039106 100644 --- a/src/efcore/Axolotl.EFCore.csproj +++ b/src/efcore/Axolotl.EFCore.csproj @@ -12,6 +12,8 @@ + Axolotl.EFCore + @@ -20,8 +22,4 @@ - - - - \ No newline at end of file diff --git a/src/http/Axolotl.Http.csproj b/src/http/Axolotl.Http.csproj index 2f1f9ea..9f4a855 100644 --- a/src/http/Axolotl.Http.csproj +++ b/src/http/Axolotl.Http.csproj @@ -12,6 +12,7 @@ + Axolotl.Http diff --git a/src/razor/Axolotl.Razor.csproj b/src/razor/Axolotl.Razor.csproj index 1c99207..2628e45 100644 --- a/src/razor/Axolotl.Razor.csproj +++ b/src/razor/Axolotl.Razor.csproj @@ -13,6 +13,8 @@ + Axolotl.Razor + @@ -23,8 +25,4 @@ - - - - \ No newline at end of file diff --git a/src/standard/Axolotl.csproj b/src/standard/Axolotl.csproj index 6b318cc..d558584 100644 --- a/src/standard/Axolotl.csproj +++ b/src/standard/Axolotl.csproj @@ -12,6 +12,7 @@ + Axolotl