Skip to content

Commit

Permalink
Remove CreateForeignKeys for indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
jersiovic committed Jun 6, 2021
1 parent 02ab692 commit 311bfab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/YesSql.Core/Sql/SchemaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ISchemaBuilder CreateMapIndexTable(Type indexType, Action<ICreateTableCom
table(createTable);
Execute(_commandInterpreter.CreateSql(createTable));

CreateForeignKey("FK_" + (collection ?? "") + indexName, indexTable, new[] { "DocumentId" }, documentTable, new[] { "Id" });
//CreateForeignKey("FK_" + (collection ?? "") + indexName, indexTable, new[] { "DocumentId" }, documentTable, new[] { "Id" });

AlterTable(indexTable, table =>
table.CreateIndex($"IDX_FK_{indexTable}", "DocumentId")
Expand Down Expand Up @@ -106,8 +106,8 @@ public ISchemaBuilder CreateReduceIndexTable(Type indexType, Action<ICreateTable
.Column<int>("DocumentId", column => column.NotNull())
);

CreateForeignKey("FK_" + bridgeTableName + "_Id", bridgeTableName, new[] { indexName + "Id" }, indexTable, new[] { "Id" });
CreateForeignKey("FK_" + bridgeTableName + "_DocumentId", bridgeTableName, new[] { "DocumentId" }, documentTable, new[] { "Id" });
//CreateForeignKey("FK_" + bridgeTableName + "_Id", bridgeTableName, new[] { indexName + "Id" }, indexTable, new[] { "Id" });
//CreateForeignKey("FK_" + bridgeTableName + "_DocumentId", bridgeTableName, new[] { "DocumentId" }, documentTable, new[] { "Id" });

AlterTable(bridgeTableName, table =>
table.CreateIndex($"IDX_FK_{bridgeTableName}", indexName + "Id", "DocumentId")
Expand Down

0 comments on commit 311bfab

Please sign in to comment.