abrandoned / activerecord-jdbcvertica-adapter

MIT License
3 stars 5 forks source link

Fix varchar column sizes #15

Open kevinwatson opened 4 years ago

kevinwatson commented 4 years ago

We're seeing varchar(80) field sizes in Vertica for fields defined as either string or text. Calling the parent method should fix this issue. We should also ignore the limits set in a migration for integer types.

kevinwatson commented 4 years ago

Sample migration:

class CreateMyTable < ActiveRecord::Migration
  def change
    create_table :my_table, :id => :bigserial do |t|
      t.text :text
      t.string :string
      t.integer :integer
      t.integer :bigserial, limit: 8
      t.float :float
      t.decimal :decimal
      t.datetime :datetime
      t.timestamp :timestamp
      t.time :time
      t.date :date
      t.binary :bytea
      t.boolean :boolean
      t.bigint :bigint
  end
end

Before (note the missing limits on the varchar fields):

CREATE TABLE my_table (id integer, text varchar, string varchar, integer integer, bigserial integer, float float, decimal decimal, datetime datetime, timestamp datetime, time time, date date, bytea bytea, boolean boolean, bigint bigint)

After:

CREATE TABLE my_table (id integer, text varchar(15000), string varchar(255), integer integer, bigserial integer, float float, decimal decimal, datetime datetime, timestamp datetime, time time, date date, bytea bytea, boolean boolean, bigint bigint)

Edit: Added the bigint type and renamed some of the columns

kevinwatson commented 4 years ago

Passing CircleCI tests (under my own account)

Screen Shot 2020-06-26 at 4 14 33 PM

kevinwatson commented 4 years ago

I believe this PR is ready for review, @film42 and @mrdeadsake

mrdeadsake commented 4 years ago

Maybe make a pre-release version to put out so we can test it?

Otherwise it looks like it's working