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

atlas schema clean in Azure SQL Server #3269

Open
AnielaN994 opened this issue Dec 17, 2024 · 8 comments
Open

atlas schema clean in Azure SQL Server #3269

AnielaN994 opened this issue Dec 17, 2024 · 8 comments
Assignees
Labels

Comments

@AnielaN994
Copy link

AnielaN994 commented Dec 17, 2024

Hello,

When I try to drop the database objects with 'atlas schema clean -u' it seems it's not creating a proper order for dropping, for example dropping first the synonyms/views then their schema and I get messages like "mssql: Cannot drop schema 'example' because it is being referenced by object 'EXAMPLE' and then I go into SQL Server and drop the objects manually in order to be able to run the script which is a bit difficult to do for a lot of objects.

Is there anything we can do for this?

Thanks.

@giautm
Copy link
Member

giautm commented Dec 17, 2024

Hello @AnielaN994, can you please share what kind of EXAMPLE object?

Or simple DDL that can reproduce the issue, thanks.

@AnielaN994
Copy link
Author

For example, I have a view and a synonym under schema 'example' and atlas is trying to drop the schema before dropping the underlying synonym and view and it returns the error "mssql: Cannot drop schema 'example' because it is being referenced by object 'synonym' or "mssql: Cannot drop schema 'example' because it is being referenced by object 'view'

@AnielaN994
Copy link
Author

I think I've understood why this is happening, it's due to atlas not creating a drop command from the synonyms, I recreated it with simple DDLs:

create schema test;
GO

create table test.table1 ([KEY] int)
GO

CREATE VIEW test.view1 AS
SELECT * from test.table1;
GO

CREATE SYNONYM test.testsynonym FOR test.view1
GO

and when running atlas schema clean, I get:

image

@giautm
Copy link
Member

giautm commented Dec 17, 2024

Atlas-CLI doesn't support SYNONYM yet, to it can't see the SYNONYM objects to drop before drop the schema.

@AnielaN994
Copy link
Author

When will synonyms be supported ?

@giautm
Copy link
Member

giautm commented Dec 17, 2024

When will synonyms be supported ?

Can you please explain the use-case of this object? We don't have the plan for it currently, but can priority for it if you need it to adapt Atlas-CLI to your team.

@a8m
Copy link
Member

a8m commented Dec 17, 2024

When will synonyms be supported ?

We can't commit to ETA on GitHub issue tracker.

@AnielaN994, it looks like you're trying to migrate a large (legacy?) schema to Atlas. We can assist with that, work closely with you (e.g., Slack connect), and set up the integration to address any missing features. If this sounds interesting, feel free to drop us a message using intercom on our website.

@a8m a8m added the MSSQL label Dec 18, 2024
@AnielaN994
Copy link
Author

AnielaN994 commented Dec 19, 2024

Hello,

We concluded we won't use synonyms anymore.

We'll check internally and come back regarding the assistance from you, thanks!!

Best Regards,
Aniela

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

No branches or pull requests

3 participants