collectiveidea/awesome_nested_set

Field 'lft' doesn't have a default value

Closed this issue · 1 comments

Hey folks I'm experimenting with awesome_nested_set for the first time. I love it, thanks for the great work.

I'm having an issue with my minitests in a rails-api app. I know what the issue is but am unsure how to fix it at this point.

When I run "rails test" I get a bunch of errors similar to the following:
StoresControllerTest#test_should_create_store:
ActiveRecord::StatementInvalid: Mysql2::Error: Field 'lft' doesn't have a default value: INSERT INTO categories (name, created_at, updated_at, id, store_id) VALUES ('MyString', '2018-02-23 03:
08:13', '2018-02-23 03:08:13', 980190962, 980190962)

Here is my Migration:
class AddLftToCategory < ActiveRecord::Migration[5.0] def change add_column :categories, :lft, :integer, :null => false add_index :categories, :lft end end

I believe the issue is a result of my migration setting ":lft, :null => false. This makes the most sense, but how can I fix this? Do I need to add something to my fixture, or is there something else I must do?

Thanks.

was just missing :rgt column.