-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Issue
The following commit changed how columns were fetched for a table: 92ff32a
The new functionality duplicates columns in my schema.rb file once per unique key constraint, resulting in my schema.rb file being unable to properly stand up a new database due to duplicate column definitions.
When I manually run the old SQL from before the aforementioned commit against my development database, the tables that meet the following criteria only get one entry per column. After the patch, the new SQL returns N number of columns depending on the number of unique indexes on the table.
Expected behavior
Each column definition should only be output to schema.rb once
Actual behavior
Column names are duplicated in schema.rb
How to reproduce
- Create a DB table with the following SQL
CREATE TABLE dbo.examples (
id int IDENTITY(1,1) NOT NULL,
example int DEFAULT 0 NOT NULL,
CONSTRAINT IX_EXAMPLE UNIQUE (example),
CONSTRAINT PK_EXAMPLE PRIMARY KEY (id)
);- Run
rails db:schema:dump - Your schema.rb file should now contain the following code:
create_table "examples", id: :integer, force: :cascade do |t|
t.integer "example", default: 0, null: false
t.integer "example", default: 0, null: false
t.index ["example"], name: "IX_EXAMPLE", unique: true
endDetails
-
Rails version:
6.0.3.4 -
SQL Server adapter version:
6.0.0 -
TinyTDS version:
2.1.3 -
FreeTDS details:
Compile-time settings (established with the "configure" script) Version: freetds v1.1.24 freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.3 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no OpenSSL: yes GnuTLS: no MARS: yes