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