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

DbMigration.CreateTable creates shared sequence (generator) for any identity column [DNET855] #787

Closed
firebird-issue-importer opened this issue Oct 22, 2018 · 7 comments

Comments

@firebird-issue-importer

Submitted by: robsonwk (robsonwk)

Using DbMigration, method CreateTable with column Identity set to true, generates one, common sequence for any table, any column.
Result sql code is as following:

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;

and trigger

CREATE OR ALTER TRIGGER "ID_USERS_ID" ACTIVE BEFORE INSERT ON "USERS"
AS
BEGIN

              if \(new\."ID" is null\) then
                begin

              new\."ID" = next value for GEN\_IDENTITY;
              end
              END;

Proposal:
For table "Users", column "ID", migration sql could be:
EXECUTE BLOCK
AS
BEGIN
if (not exists(select 1 from rdb$generators where rdb$generator_name = 'GEN_IDENTITY_USERS_ID')) then
begin
execute statement 'create sequence GEN_IDENTITY_USERS_ID';
end
END;

and trigger

CREATE OR ALTER TRIGGER "ID_USERS_ID" ACTIVE BEFORE INSERT ON "USERS"
AS
BEGIN

              if \(new\."ID" is null\) then
                begin

              new\."ID" = next value for GEN\_IDENTITY\_USERS\_ID;
              end
              END;
@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Commented by: @cincuranet

This is intentional. If you want different behavior, implement IFbMigrationSqlGeneratorBehavior.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Modified by: @cincuranet

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

resolution: Won't Fix [ 2 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Modified by: @cincuranet

status: Closed [ 6 ] => Reopened [ 4 ]

resolution: Won't Fix [ 2 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Modified by: @cincuranet

Component: Entity Framework [ 10110 ]

Component: http://ADO.NET Provider [ 10041 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Modified by: @cincuranet

status: Reopened [ 4 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2018

Commented by: robsonwk (robsonwk)

Ok, thank you for such quick response, however could you in a few words give exaplanation of a such design?

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

Successfully merging a pull request may close this issue.

None yet
2 participants