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

Support for structure.sql seems to be broken #502

Open
gucki opened this issue Aug 24, 2021 · 4 comments
Open

Support for structure.sql seems to be broken #502

gucki opened this issue Aug 24, 2021 · 4 comments

Comments

@gucki
Copy link

gucki commented Aug 24, 2021

activerecord-sqlserver-adapter (6.1.0.0)
tiny_tds (2.1.5)

Compile-time settings (established with the "configure" script)
Version: freetds v1.2.18
freetds.conf directory: /etc
MS db-lib source compatibility: yes
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: auto
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: yes
GnuTLS: no
MARS: yes

The structure.sql (config.active_record.schema_format = :sql) generated can't be imported (rails db:setup) again. Bugs noticed so far:

  • Column names are not quoted. For example the column "key" of "ar_internal_metadata" causes: ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near the keyword 'key'.
  • Views are not supported. Import fails with: ActiveRecord::StatementInvalid: TinyTds::Error: 'CREATE VIEW' must be the first statement in a query batch.
@aharpervc
Copy link
Contributor

This seems like it's more related to the AR SQL Server adapter, so probably best to ask over there: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues

@gucki
Copy link
Author

gucki commented Sep 9, 2021

Hmm yeah, maybe you are right. But afaik it just calls some command-line tool to generate the file, so most probably they won't be able to do anything about it (too). But I just created an issue there rails-sqlserver/activerecord-sqlserver-adapter#944

@Michoels
Copy link

This is still an issue in 2024.
The created structure.sql fails to import when running rails db:schema:load.

@freddy77
Copy link

Fixed in FreeTDS 1.4.12 and master branch

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

4 participants