dimanche 13 septembre 2015

Unable to alter table with unique constrain using Sequel and Sqlite3

These are my migrations for the table users_hobbies:

Create:

Sequel.migration do
  up do
    create_table :users_hobbies do
      Integer :user_id
      Integer :hobby_id
    end
  end

  down do
    drop_table :hobbies_users
  end
end

Alter:

Sequel.migration do
  up do
    alter_table :users_hobbies do
      unique [:user_id, :hobby_id]
    end
  end

  down do
  end
end

When I did the second migration I got the following error, any ideas?

NoMethodError: undefined method 'unique' for #<Sequel::Schema::AlterTableGenerator:0x007fba1aea7c30>

Aucun commentaire:

Enregistrer un commentaire