summaryrefslogtreecommitdiff
path: root/Migrations
diff options
context:
space:
mode:
Diffstat (limited to 'Migrations')
-rw-r--r--Migrations/20220915235337_DropBookPublicationDate.Designer.cs57
-rw-r--r--Migrations/20220915235337_DropBookPublicationDate.cs27
-rw-r--r--Migrations/20220915235413_AddBookPublicationYear.Designer.cs60
-rw-r--r--Migrations/20220915235413_AddBookPublicationYear.cs26
-rw-r--r--Migrations/LibraryContextModelSnapshot.cs9
5 files changed, 177 insertions, 2 deletions
diff --git a/Migrations/20220915235337_DropBookPublicationDate.Designer.cs b/Migrations/20220915235337_DropBookPublicationDate.Designer.cs
new file mode 100644
index 0000000..e97f909
--- /dev/null
+++ b/Migrations/20220915235337_DropBookPublicationDate.Designer.cs
@@ -0,0 +1,57 @@
+// <auto-generated />
+using System;
+using LibraryAPI.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ [DbContext(typeof(LibraryContext))]
+ [Migration("20220915235337_DropBookPublicationDate")]
+ partial class DropBookPublicationDate
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("LibraryAPI.Models.Book", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
+
+ b.Property<int>("Edition")
+ .HasColumnType("integer");
+
+ b.Property<string[]>("Genres")
+ .IsRequired()
+ .HasColumnType("text[]");
+
+ b.Property<string>("ISBN")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Books");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20220915235337_DropBookPublicationDate.cs b/Migrations/20220915235337_DropBookPublicationDate.cs
new file mode 100644
index 0000000..4d16267
--- /dev/null
+++ b/Migrations/20220915235337_DropBookPublicationDate.cs
@@ -0,0 +1,27 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ public partial class DropBookPublicationDate : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "PublicationDate",
+ table: "Books");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<DateTime>(
+ name: "PublicationDate",
+ table: "Books",
+ type: "timestamp with time zone",
+ nullable: false,
+ defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
+ }
+ }
+}
diff --git a/Migrations/20220915235413_AddBookPublicationYear.Designer.cs b/Migrations/20220915235413_AddBookPublicationYear.Designer.cs
new file mode 100644
index 0000000..072bb5c
--- /dev/null
+++ b/Migrations/20220915235413_AddBookPublicationYear.Designer.cs
@@ -0,0 +1,60 @@
+// <auto-generated />
+using System;
+using LibraryAPI.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ [DbContext(typeof(LibraryContext))]
+ [Migration("20220915235413_AddBookPublicationYear")]
+ partial class AddBookPublicationYear
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("LibraryAPI.Models.Book", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
+
+ b.Property<int>("Edition")
+ .HasColumnType("integer");
+
+ b.Property<string[]>("Genres")
+ .IsRequired()
+ .HasColumnType("text[]");
+
+ b.Property<string>("ISBN")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<int>("PublicationYear")
+ .HasColumnType("integer");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Books");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20220915235413_AddBookPublicationYear.cs b/Migrations/20220915235413_AddBookPublicationYear.cs
new file mode 100644
index 0000000..12bf4b3
--- /dev/null
+++ b/Migrations/20220915235413_AddBookPublicationYear.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ public partial class AddBookPublicationYear : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<int>(
+ name: "PublicationYear",
+ table: "Books",
+ type: "integer",
+ nullable: false,
+ defaultValue: 0);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "PublicationYear",
+ table: "Books");
+ }
+ }
+}
diff --git a/Migrations/LibraryContextModelSnapshot.cs b/Migrations/LibraryContextModelSnapshot.cs
index 734dcc0..d340ff6 100644
--- a/Migrations/LibraryContextModelSnapshot.cs
+++ b/Migrations/LibraryContextModelSnapshot.cs
@@ -41,8 +41,13 @@ namespace LibraryAPI.Migrations
.IsRequired()
.HasColumnType("text");
- b.Property<DateTime>("PublicationDate")
- .HasColumnType("timestamp with time zone");
+ b.Property<int>("PublicationYear")
+ .IsRequired()
+ .HasColumnType("integer");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
b.HasKey("Id");