Skip to content

Commit

Permalink
Convert remove method to macro, similar to remove_belongs_to (#321).
Browse files Browse the repository at this point in the history
  • Loading branch information
wout authored and paulcsmith committed May 13, 2020
1 parent 05c1c62 commit 7f5c311
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/avram/migrator/alter_table_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ class Avram::Migrator::AlterTableStatement
rename {{old_association_name}}_id, {{new_association_name}}_id
end

def remove(name : Symbol)
dropped_rows << " DROP #{name.to_s}"
macro remove(name)
{% unless name.is_a?(SymbolLiteral) %}
{% raise symbol_expected_message % {"remove", name} %}
{% end %}
dropped_rows << " DROP #{{{name}}}"
end

macro remove_belongs_to(association_name)
Expand Down

0 comments on commit 7f5c311

Please sign in to comment.