-
Notifications
You must be signed in to change notification settings - Fork 563
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
use tsql-ttds for structure_load (fixes #956) #957
Conversation
@jonahgeorge Did you close this for any particular reason? Did you find an alternate solution? I'm trying to support a join table using a view in my Rails app, and ye ole
|
I ran into the same |
It appears I missed this notification way back when 🙈 Sorry about that! I'm operating on a slightly hazy old memory here, so bear with me.
I recall having issues with the format generated by
Hah, I did not; however, the current solution is subpar-- We don't redump the structure on migrations and instead rely on only the migration chain. I may have some time in the coming months to take another look at this; especially, due to motivation to move off of my fork for Rails 7.1 support. I'll post any updates on this PR and potentially will re-open it. |
Probably a better place for this, but I'll leave it here for now. I've also encountered an issue in the dumped structure.sql file where the default NEWID is not being included for UUID primary keys. |
A few recent findings: My initial attempts at using the schema created by A while back I got around this by using a combination SQL Scripts > Generate DDL to Clipboard feature in Jetbrains DataGrip + In looking for more recent tools for schema dumping I came across A quick test of commands below (with the patches in this PR & some minimal manual editing of the generated file) applied successfully: pip install mssql-scripter
mssql-scripter \
-S localhost \
-U "user" \
-P "password" \
-d "database" \
--display-progress \
--enable-toolsservice-logging > db/structure.sql
rails db:create && rails db:schema:load However, as the migrations table is not populated it causes issues with running tests. I'll have to look at how the Postgres adapter includes data for a subset of tables. Additionally, it took nearly 3 minutes to dump my entire schema (~1,200 objects). Potentially a path forward for the library would be to depend on one of the projects listed above. Alternatively, I was able to track down the majority of the schema generation logic to the following package but it would be a mountain of work to re-implement in Ruby. One last alternative could be a Ruby re-write of |
The FreeTDS guys have a fix for |
This PR modifies
structure_load
to utilizetsql-ttds
to load thestructure.sql
file generated bystructure_dump
. With this change, we can remove the gsub to removeGO
commands which should allow views to be properly imported.Fixes #956