mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-24 03:06:38 +08:00
Table name should not include the prefix: Orchard_Blogs_BlogArchiveRecord during Data Migration scaffolding
--HG-- branch : dev
This commit is contained in:
parent
0cf950bc83
commit
db85727d0a
@ -5,7 +5,7 @@ namespace $$FeatureName$$.DataMigrations {
|
||||
public class $$ClassName$$DataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
$$Commands$$
|
||||
$$Commands$$
|
||||
|
||||
return 0100;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Orchard.DevTools.Services {
|
||||
}
|
||||
|
||||
public override void Visit(CreateTableCommand command) {
|
||||
_output.WriteLine("// Creating table {0}", command.Name);
|
||||
_output.WriteLine("\t\t\t// Creating table {0}", command.Name);
|
||||
_output.WriteLine("\t\t\tSchemaBuilder.CreateTable(\"{0}\", table => table", command.Name);
|
||||
|
||||
foreach ( var createColumn in command.TableCommands.OfType<CreateColumnCommand>() ) {
|
||||
|
@ -35,13 +35,19 @@ namespace Orchard.Data.Migration.Generator {
|
||||
var tablesField = typeof(Configuration).GetField("tables", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
var tables = ((IDictionary<string, Table>) tablesField.GetValue(configuration)).Values;
|
||||
|
||||
string prefix = feature.Replace(".", "_") + "_";
|
||||
|
||||
foreach(var table in tables.Where(t => parameters.RecordDescriptors.Any(rd => rd.Feature.Descriptor.Name == feature && rd.TableName == t.Name))) {
|
||||
if(drop) {
|
||||
yield return new DropTableCommand(table.Name);
|
||||
string tableName = table.Name;
|
||||
if(tableName.StartsWith(prefix)) {
|
||||
tableName = tableName.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
var command = new CreateTableCommand(table.Name);
|
||||
if(drop) {
|
||||
yield return new DropTableCommand(tableName);
|
||||
}
|
||||
|
||||
var command = new CreateTableCommand(tableName);
|
||||
|
||||
foreach(var column in table.ColumnIterator) {
|
||||
var table1 = table;
|
||||
|
Loading…
Reference in New Issue
Block a user