Made description and note optional, auto added title and description from metadata if not provided
This commit is contained in:
210
YABA.Data/Migrations/20230128193757_ModifiedBookmarkTable_MakeNoteAndDescriptionOptional.Designer.cs
generated
Normal file
210
YABA.Data/Migrations/20230128193757_ModifiedBookmarkTable_MakeNoteAndDescriptionOptional.Designer.cs
generated
Normal file
@ -0,0 +1,210 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using YABA.Data.Context;
|
||||
|
||||
namespace YABA.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(YABABaseContext))]
|
||||
[Migration("20230128193757_ModifiedBookmarkTable_MakeNoteAndDescriptionOptional")]
|
||||
partial class ModifiedBookmarkTable_MakeNoteAndDescriptionOptional
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63)
|
||||
.HasAnnotation("ProductVersion", "5.0.17")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
modelBuilder.Entity("YABA.Models.Bookmark", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedOn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_on");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<bool>("IsHidden")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_hidden");
|
||||
|
||||
b.Property<DateTimeOffset>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("note");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("url");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_bookmarks");
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.HasDatabaseName("ix_bookmarks_user_id");
|
||||
|
||||
b.ToTable("bookmarks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.BookmarkTag", b =>
|
||||
{
|
||||
b.Property<int>("BookmarkId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("bookmark_id");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("tag_id");
|
||||
|
||||
b.HasKey("BookmarkId", "TagId")
|
||||
.HasName("pk_bookmark_tags");
|
||||
|
||||
b.HasIndex("TagId")
|
||||
.HasDatabaseName("ix_bookmark_tags_tag_id");
|
||||
|
||||
b.ToTable("bookmark_tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.Tag", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<bool>("IsHidden")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_hidden");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_tags");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_tags_name");
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.HasDatabaseName("ix_tags_user_id");
|
||||
|
||||
b.ToTable("tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Auth0Id")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("auth0id");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedOn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_on");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTimeOffset>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("Auth0Id")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_users_auth0id");
|
||||
|
||||
b.ToTable("users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.Bookmark", b =>
|
||||
{
|
||||
b.HasOne("YABA.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.HasConstraintName("fk_bookmarks_users_user_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.BookmarkTag", b =>
|
||||
{
|
||||
b.HasOne("YABA.Models.Bookmark", "Bookmark")
|
||||
.WithMany()
|
||||
.HasForeignKey("BookmarkId")
|
||||
.HasConstraintName("fk_bookmark_tags_bookmarks_bookmark_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("YABA.Models.Tag", "Tag")
|
||||
.WithMany()
|
||||
.HasForeignKey("TagId")
|
||||
.HasConstraintName("fk_bookmark_tags_tags_tag_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Bookmark");
|
||||
|
||||
b.Navigation("Tag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YABA.Models.Tag", b =>
|
||||
{
|
||||
b.HasOne("YABA.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.HasConstraintName("fk_tags_users_user_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace YABA.Data.Migrations
|
||||
{
|
||||
public partial class ModifiedBookmarkTable_MakeNoteAndDescriptionOptional : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "note",
|
||||
table: "bookmarks",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "description",
|
||||
table: "bookmarks",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "note",
|
||||
table: "bookmarks",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "description",
|
||||
table: "bookmarks",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,6 @@ namespace YABA.Data.Migrations
|
||||
.HasColumnName("created_on");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
@ -45,7 +44,6 @@ namespace YABA.Data.Migrations
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("note");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user