Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The auto created triggers can have names which are too long [DNET718] #231

Closed
firebird-automations opened this issue Nov 17, 2016 · 2 comments

Comments

@firebird-automations
Copy link

Submitted by: Leonard Wennekers (l.wennekers)

The migration below will generate an exception on the trigger because of the identify: true inside SequenceId = c.Long(nullable: false, identify: true)
The used name of the trigger ID_HistoryUnknownMessages_SequenceId is not allowed because of it's length.

CreateTable(
"HistoryUnknownMessages",
c => new
{
SequenceId = c.Long(nullable: false, identify: true),
EventOccurred = c.DateTime(nullable: false),
Address = c.String(nullable: false, maxLength: 15),
Message = c.String(nullable: false, maxLength: 1000),
})
.PrimaryKey(t => t.SequenceId, name: "PK_HistoryUnknownMessages");

2016-11-17 09:20:57,105 [TestRunnerThread] DEBUG IOLAN.Context.Management.MigrationLogger - Verbose (): CREATE TABLE "HistoryUnknownMessages" (
"SequenceId" BIGINT NOT NULL,
"EventOccurred" TIMESTAMP NOT NULL,
"Address" VARCHAR(15) NOT NULL,
"Message" VARCHAR(1000) NOT NULL
)
2016-11-17 09:20:57,105 [TestRunnerThread] DEBUG IOLAN.Context.Management.MigrationLogger - Verbose (): ALTER TABLE "HistoryUnknownMessages" ADD CONSTRAINT "PK_HistoryUnknownMessages" PRIMARY KEY ("SequenceId")
2016-11-17 09:20:57,105 [TestRunnerThread] DEBUG IOLAN.Context.Management.MigrationLogger - Verbose (): EXECUTE BLOCK
AS
BEGIN
if (not exists(select 1 from rdb$generators where rdb$generator_name = 'GEN_IDENTITY')) then
begin
execute statement 'create sequence GEN_IDENTITY';
end
END
2016-11-17 09:20:57,105 [TestRunnerThread] DEBUG IOLAN.Context.Management.MigrationLogger - Verbose (): CREATE OR ALTER TRIGGER "ID_HistoryUnknownMessages_SequenceId" ACTIVE BEFORE INSERT ON "HistoryUnknownMessages"
AS
BEGIN
if (new."SequenceId" is null) then
begin
new."SequenceId" = next value for GEN_IDENTITY;
end
END

@firebird-automations
Copy link
Author

Commented by: @cincuranet

That's where you can plug your own IFbMigrationSqlGeneratorBehavior (https://github.com/cincuranet/FirebirdSql.Data.FirebirdClient/blob/master/Provider/src/EntityFramework.Firebird/IFbMigrationSqlGeneratorBehavior.cs). There's no single correct solution for this, thus it's open for tweaking.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants