luckyframework / luckyframework/avram

I get error "undefined method 'add_column'" when trying to perform what appears to be a valid migration

Open
#19 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarify api
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

When attempting to migrate

```crystal
class CreateListAndListEntry::V20180930082950 < LuckyRecord::Migrator::Migration::V1
def migrate
create :list_entries do
add title : String
add_belongs_to list : List, on_delete: :do_nothing
add_belongs_to author : User, on_delete: :cascade
end
create :lists do
add title : String
end
alter :users do
add list_entries : ListEntry, fill_existing_with: :nothing
end
end

def rollback
drop :list_entries
drop :lists
alter :users do
remove :list_entries
end
end
end
```

I receive the following error message: [undefined method 'add_column'](https://github.com/dscottboggs/lucky-shopping-list/blob/master/ERROR.txt)

You can find the whole project here https://github.com/dscottboggs/lucky-shopping-list

thanks for the help

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the migration shown in the issue and the linked ERROR.txt, then reproduce the failure in the lucky-shopping-list project. Trace the migration operation that reports undefined method 'add_column' and compare it with the supported Avram migration API. Done means the migration runs without that error or the issue documents the required migration syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgres
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.