You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
The text was updated successfully, but these errors were encountered:
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
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
The text was updated successfully, but these errors were encountered: