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

Schema DDL does not respect function ordering #66

Open
ghost opened this issue Apr 14, 2022 · 1 comment
Open

Schema DDL does not respect function ordering #66

ghost opened this issue Apr 14, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 14, 2022

  1. Please check DbSchema Help / Output logs for errors.
09:00:21 Import task done.
09:00:21 REVERSE ENGINEERED 13 TABLES FROM AzureSQL.
09:04:00 > exportSchemaScript
09:04:00 Dialog Export Schema & Data
09:04:19 > chooseFile
09:04:28 > ok
09:04:28 Dialog Select Schemas & Tables to Include
09:12:55 > outputLogs
09:12:55 Dialog Output Logs
  1. Please include the DbSchema version, operating system and used database

DbSchema: 9.0.0
Azure SQL

  1. The steps to reproduce this issue

Create functions, which depend on each other

CREATE OR ALTER FUNCTION security.ufnHasDatasetAccess(@DatasetID int)
    RETURNS TABLE
WITH SCHEMABINDING
AS
    RETURN
        select 1 as able from security.ufnHasIndirectAccess(@DatasetID)
GO


CREATE   FUNCTION security.ufnHasIndirectAccess(@ParentID int)
    RETURNS TABLE
WITH SCHEMABINDING
AS
    RETURN
        SELECT 1 as able
GO

Go to DBSchema tool: Schema -> Generate Schema DDL. Produced ordering is incorrect, since security.ufnHasDatasetAccess gets put first instead of schema.ufnHasIndirectAccess

@ghost
Copy link
Author

ghost commented Apr 14, 2022

I think the generated scripts are also missing GO after function definition

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

No branches or pull requests

0 participants