This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from rinkudesu/unique-index-on-link-url
Add unique index on link url for user
- Loading branch information
Showing
8 changed files
with
191 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...s/Rinkudesu.Services.Links/Migrations/20230415192012_AddUniqueUrlIndexForUser.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...ices.Links/Rinkudesu.Services.Links/Migrations/20230415192012_AddUniqueUrlIndexForUser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Rinkudesu.Services.Links.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddUniqueUrlIndexForUser : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateIndex( | ||
name: "IX_Links_LinkUrl_CreatingUserId", | ||
table: "Links", | ||
columns: new[] { "LinkUrl", "CreatingUserId" }, | ||
unique: true); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropIndex( | ||
name: "IX_Links_LinkUrl_CreatingUserId", | ||
table: "Links"); | ||
} | ||
} | ||
} |
139 changes: 71 additions & 68 deletions
139
Rinkudesu.Services.Links/Rinkudesu.Services.Links/Migrations/LinkDbContextModelSnapshot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,71 @@ | ||
// <auto-generated /> | ||
using System; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
using Rinkudesu.Services.Links.Data; | ||
|
||
#nullable disable | ||
|
||
namespace Rinkudesu.Services.Links.Migrations | ||
{ | ||
[DbContext(typeof(LinkDbContext))] | ||
partial class LinkDbContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "6.0.1") | ||
.HasAnnotation("Relational:MaxIdentifierLength", 63); | ||
|
||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); | ||
|
||
modelBuilder.Entity("Rinkudesu.Services.Links.Models.Link", b => | ||
{ | ||
b.Property<Guid>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("uuid"); | ||
b.Property<Guid>("CreatingUserId") | ||
.HasColumnType("uuid"); | ||
b.Property<DateTime>("CreationDate") | ||
.HasColumnType("timestamp with time zone"); | ||
b.Property<string>("Description") | ||
.HasMaxLength(1000) | ||
.HasColumnType("character varying(1000)"); | ||
b.Property<DateTime>("LastUpdate") | ||
.HasColumnType("timestamp with time zone"); | ||
b.Property<string>("LinkUrl") | ||
.IsRequired() | ||
.HasMaxLength(200) | ||
.HasColumnType("character varying(200)"); | ||
b.Property<int>("PrivacyOptions") | ||
.HasColumnType("integer"); | ||
b.Property<string>("ShareableKey") | ||
.HasMaxLength(51) | ||
.HasColumnType("character varying(51)"); | ||
b.Property<string>("Title") | ||
.IsRequired() | ||
.HasMaxLength(250) | ||
.HasColumnType("character varying(250)"); | ||
b.HasKey("Id"); | ||
b.ToTable("Links"); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} | ||
// <auto-generated /> | ||
using System; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
using Rinkudesu.Services.Links.Data; | ||
|
||
#nullable disable | ||
|
||
namespace Rinkudesu.Services.Links.Migrations | ||
{ | ||
[DbContext(typeof(LinkDbContext))] | ||
partial class LinkDbContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "7.0.1") | ||
.HasAnnotation("Relational:MaxIdentifierLength", 63); | ||
|
||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); | ||
|
||
modelBuilder.Entity("Rinkudesu.Services.Links.Models.Link", b => | ||
{ | ||
b.Property<Guid>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("uuid"); | ||
b.Property<Guid>("CreatingUserId") | ||
.HasColumnType("uuid"); | ||
b.Property<DateTime>("CreationDate") | ||
.HasColumnType("timestamp with time zone"); | ||
b.Property<string>("Description") | ||
.HasMaxLength(1000) | ||
.HasColumnType("character varying(1000)"); | ||
b.Property<DateTime>("LastUpdate") | ||
.HasColumnType("timestamp with time zone"); | ||
b.Property<string>("LinkUrl") | ||
.IsRequired() | ||
.HasMaxLength(200) | ||
.HasColumnType("character varying(200)"); | ||
b.Property<int>("PrivacyOptions") | ||
.HasColumnType("integer"); | ||
b.Property<string>("ShareableKey") | ||
.HasMaxLength(51) | ||
.HasColumnType("character varying(51)"); | ||
b.Property<string>("Title") | ||
.IsRequired() | ||
.HasMaxLength(250) | ||
.HasColumnType("character varying(250)"); | ||
b.HasKey("Id"); | ||
b.HasIndex("LinkUrl", "CreatingUserId") | ||
.IsUnique(); | ||
b.ToTable("Links"); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
Rinkudesu.Services.Links/Rinkudesu.Services.Links/add_migration.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
RINKU_KAFKA_ADDRESS="empty" RINKU_KAFKA_USER="empty" RINKU_KAFKA_PASSWORD="empty" RINKU_KAFKA_CLIENT_ID="empty" RINKU_KAFKA_CONSUMER_GROUP_ID="empty" RINKUDESU_TAGS="empty" RINKU_LINKS_CONNECTIONSTRING="empty" dotnet ef migrations add $1 |