使用fluentmigrator在Oracle中创建序列

时间:2012-07-05 09:35:35

标签: oracle11g fluent-migrator

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

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

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行)?但是这个背景下的架构是什么?

0 个答案:

没有答案