Red Gate forums :: View topic - SQL Packager does not package dependencies in correct order?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Packager 6
SQL Packager 6 forum

SQL Packager does not package dependencies in correct order?

Search in SQL Packager 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
kconnor@ncu.edu



Joined: 11 May 2012
Posts: 2

PostPosted: Fri May 11, 2012 10:36 pm    Post subject: SQL Packager does not package dependencies in correct order? Reply with quote

I'm trying to package a database with SQL Packager. This database contains objects with dependencies on other objects (i.e. a table created in a schema which must have the schema created prior to the table, or a table with FK constraints which obviously depends on the referenced table being created).

SQL Packager creates the SQL script to create the database, with the objects in absolutely horrid order.

For example... the create order for various objects in the script are as follows:
1. logins (even though I expressly unchecked the box to create these logins)
2. db users (I cleared the checkbox)
3. schemas
4. defaults
5. types

The very next object that gets created... is a Function.

And the function runs SELECT statements against tables in the database. But those tables aren't created yet.

So obviously the CREATE FUNCTION script errors out.

Why does this product not script object creation in the correct order of its dependencies? Looking through this DB creation script, it'll be an absolute nightmare to shuffle everything around in the correct order of dependency. I'll have to cut all the keys away from the tables and just create the tables as heaps, then go through and assign all the PK's, then assign all the FK's, and so on... all manually.

I bought your product so I wouldn't have to do that. I can do that on my own with SSMS.
Back to top
View user's profile Send private message
Chris Auckland



Joined: 24 Oct 2006
Posts: 755
Location: Red Gate Software Ltd.

PostPosted: Mon May 14, 2012 5:41 pm    Post subject: Reply with quote

Thanks for your post.

SQL Packager should script the objects in dependency order. If it's not doing that then it's either a bug, or you have a nasty circular dependency that we can't handle.

The logins and users have probably been re-added to your project because some other selected objects have a dependency to them. It's a default option to 'include dependencies'.

If you have SQL Compare, I would suggest setting up the same project and see if the script is correct using that. If you're creating an install package using SQL Packager, you can simulate this by using SQL Compare to a blank database. The reason I ask is because SQL Packager uses the SQL Compare engine; only a much older version. If the problem is still in the latest version of SQL Compare, then it's probably a new issue to us.

Let me know what you find.
_________________
Chris
Back to top
View user's profile Send private message Send e-mail
kconnor@ncu.edu



Joined: 11 May 2012
Posts: 2

PostPosted: Thu May 17, 2012 5:52 pm    Post subject: Reply with quote

Chris, thank you for your response.

I did try SQL Compare against a blank database shortly after my original post, and got the same behavior.

Could this possibly be resolved in a 2-stage process by telling Packager to not include FK's in the 1st step, then telling Packager to only target FK's in a second stage (or using SQL Compare to grab the FK's)? Is this something these tools can do?
Back to top
View user's profile Send private message
Chris Auckland



Joined: 24 Oct 2006
Posts: 755
Location: Red Gate Software Ltd.

PostPosted: Fri May 18, 2012 10:03 am    Post subject: Reply with quote

Thanks for your reply.

You could try using the 'ignore foreign keys' option for the first pass.

I'm not exactly sure why you would need to do a 2 step sync', but I'm happy to look into it if you're able to send me a copy of your schema.
_________________
Chris
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group