3

我是 FluentMigrator 和 Oracle 的新手。我们正在尝试在我们的迁移脚本中支持 MsSql 服务器、Postgres 和 Oracle。

由于NHibernate在Oracle中使用sequence,在另外两个中使用identity,我们需要添加一个sequence;

public class CreateTagSystem : Migration
{
    public override void Up()
    {
        IfDatabase("MsSql2008", "Postgres").Create.Table("TestTable").WithColumn("Id").AsInt16().PrimaryKey().Identity();

        IfDatabase("Oracle").Create.Table("TestTable").WithColumn("Id").AsInt16().PrimaryKey();

        IfDatabase("Oracle").Create.Sequence("hibernate_sequence");
    }

    public override void Down()
    {
        Delete.Table("TestTable");
    }
}

这导致;

System.NullReferenceException : Object reference not set to an instance of an object.
at FluentMigrator.Runner.Generators.Generic.GenericQuoter.IsQuoted(String name) in D:\Development\Code\GitHub\fluentmigrator\src\FluentMigrator.Runner\Generators\Generic\GenericQuoter.cs: line 105
at FluentMigrator.Runner.Generators.Generic.GenericQuoter.QuoteSchemaName(String schemaName) in D:\Development\Code\GitHub\fluentmigrator\src\FluentMigrator.Runner\Generators\Generic\GenericQuoter.cs: line 183
at FluentMigrator.Runner.Generators.Generic.GenericGenerator.Generate(CreateSequenceExpression expression) in D:\Development\Code\GitHub\fluentmigrator\src\FluentMigrator.Runner\Generators\Generic\GenericGenerator.cs: line 360
at FluentMigrator.Runner.Processors.ProcessorBase.Process(CreateSequenceExpression expression) in ProcessorBase.cs: line 138
at FluentMigrator.Expressions.CreateSequenceExpression.ExecuteWith(IMigrationProcessor processor) in D:\Development\Code\GitHub\fluentmigrator\src\FluentMigrator\Expressions\CreateSequenceExpression.cs: line 17
at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClasse.<ExecuteExpressions>b__b() in MigrationRunner.cs: line 349
at FluentMigrator.Runner.MigrationRunner.AnnounceTime(String message, Action action) in MigrationRunner.cs: line 379
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions) in MigrationRunner.cs: line 362
at FluentMigrator.Runner.MigrationRunner.Up(IMigration migration) in MigrationRunner.cs: line 304
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(Int64 version) in MigrationRunner.cs: line 189
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement) in MigrationRunner.cs: line 96  

查看源代码我需要一个模式(参见 GenericGenerator.cs 第 360 行)?但是在这种情况下,模式是什么?

4

0 回答 0