luckyframework / luckyframework/avram

Alternate column names

Open
#378 6 comments 3 reactions 0 assignees View on GitHub
feature request hacktoberfest
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

We have several apps built in different languages that use the same database. At some point in the last 15 years of this app running, some columns have been named wonky or misspelled. We can't just easily run a `RENAME COLUMN` migration because there's no telling where all this thing may be called.

What if we had a way to rename the method that calls a column?

```crystal
table do
column email : String, from: "employeemail"
end
```

This way I could also do `UserQuery.new.email("b@a.com")` which would still generate `SELECT * FROM users WHERE employeemail = 'b@a.com'`

Contributor guide

Open the contributing guide

Research direction

Start at the `table do` declaration and trace how `UserQuery.new.email("b@a.com")` becomes SQL. The change is complete when an alternate method name can target the existing `employeemail` column while generated queries still use that database column.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgresql
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.