mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge pull request #5338 from qt1/IBN-Labs/Schemabuilder.TableDbName
Provide full table name prefix for migrations
This commit is contained in:
@@ -24,5 +24,10 @@ namespace Orchard.Tests.DataMigration.Utilities {
|
||||
|
||||
public void Visit(DropForeignKeyCommand command) {
|
||||
}
|
||||
|
||||
public string PrefixTableName(string tableName) {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -91,7 +91,7 @@ namespace Orchard.Data.Migration.Interpreters {
|
||||
RunPendingStatements();
|
||||
}
|
||||
|
||||
private string PrefixTableName(string tableName) {
|
||||
public string PrefixTableName(string tableName) {
|
||||
if (string.IsNullOrEmpty(_shellSettings.DataTablePrefix))
|
||||
return tableName;
|
||||
return _shellSettings.DataTablePrefix + "_" + tableName;
|
||||
|
@@ -9,5 +9,6 @@ namespace Orchard.Data.Migration.Interpreters {
|
||||
void Visit(SqlStatementCommand command);
|
||||
void Visit(CreateForeignKeyCommand command);
|
||||
void Visit(DropForeignKeyCommand command);
|
||||
string PrefixTableName(string tableName);
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,13 @@ namespace Orchard.Data.Migration.Schema {
|
||||
public Func<string, string> FormatPrefix {
|
||||
get { return _formatPrefix; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translate Table name into database table name - including prefixes
|
||||
/// </summary>
|
||||
public virtual string TableDbName(string srcTable) {
|
||||
return _interpreter.PrefixTableName(String.Concat(FormatPrefix(FeaturePrefix), srcTable));
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateTable(string name, Action<CreateTableCommand> table) {
|
||||
var createTable = new CreateTableCommand(String.Concat(_formatPrefix(_featurePrefix), name));
|
||||
|
Reference in New Issue
Block a user