Merge pull request #4726 from sbwalker/dev
fix #4722 - support PrincipalSchema when creating foreign keys (credit @Hypnodude)
This commit is contained in:
commit
5fb80c1a7b
|
@ -319,6 +319,19 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
schema: Schema);
|
schema: Schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void AddForeignKey(string foreignKeyName, string columnName, string principalTable, string principalColumn, string principalSchema, ReferentialAction onDelete)
|
||||||
|
{
|
||||||
|
_migrationBuilder.AddForeignKey(
|
||||||
|
name: RewriteName(foreignKeyName),
|
||||||
|
table: RewriteName(EntityTableName),
|
||||||
|
column: RewriteName(columnName),
|
||||||
|
principalTable: RewriteName(principalTable),
|
||||||
|
principalColumn: RewriteName(principalColumn),
|
||||||
|
principalSchema: RewriteName(principalSchema),
|
||||||
|
onDelete: onDelete,
|
||||||
|
schema: Schema);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a Migration to add an Index to the Entity (table)
|
/// Creates a Migration to add an Index to the Entity (table)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -368,6 +381,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
column: foreignKey.Column,
|
column: foreignKey.Column,
|
||||||
principalTable: RewriteName(foreignKey.PrincipalTable),
|
principalTable: RewriteName(foreignKey.PrincipalTable),
|
||||||
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
||||||
|
principalSchema: RewriteName(foreignKey.PrincipalSchema),
|
||||||
onDelete: foreignKey.OnDeleteAction);
|
onDelete: foreignKey.OnDeleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +395,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
column: RewriteName(foreignKey.ColumnName),
|
column: RewriteName(foreignKey.ColumnName),
|
||||||
principalTable: RewriteName(foreignKey.PrincipalTable),
|
principalTable: RewriteName(foreignKey.PrincipalTable),
|
||||||
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
||||||
|
principalSchema: RewriteName(foreignKey.PrincipalSchema),
|
||||||
onDelete: foreignKey.OnDeleteAction,
|
onDelete: foreignKey.OnDeleteAction,
|
||||||
schema: Schema);
|
schema: Schema);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,16 @@ namespace Oqtane.Migrations
|
||||||
OnDeleteAction = onDeleteAction;
|
OnDeleteAction = onDeleteAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForeignKey(string name, Expression<Func<TEntityBuilder, object>> column, string principalTable, string principalColumn, string principalSchema, ReferentialAction onDeleteAction)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Column = column;
|
||||||
|
PrincipalTable = principalTable;
|
||||||
|
PrincipalColumn = principalColumn;
|
||||||
|
PrincipalSchema = principalSchema;
|
||||||
|
OnDeleteAction = onDeleteAction;
|
||||||
|
}
|
||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
public Expression<Func<TEntityBuilder, object>> Column { get;}
|
public Expression<Func<TEntityBuilder, object>> Column { get;}
|
||||||
|
@ -34,6 +44,8 @@ namespace Oqtane.Migrations
|
||||||
|
|
||||||
public string PrincipalColumn { get; }
|
public string PrincipalColumn { get; }
|
||||||
|
|
||||||
|
public string PrincipalSchema { get; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user