luckyframework / luckyframework/avram
Column migration helper with sequences
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Related: https://github.com/luckyframework/avram/issues/910
Related: https://github.com/luckyframework/avram/issues/797
This would be more of a column helper so when you define a column that you want a default to be a sequence, it sets everything up for you.
```crystal
create :accounts do
add number : Int64, default: :sequence
end
```
My thought is that this would automatiically create this column and a sequence as well as set the default value to that sequence.
```
CREATE SEQUENCE accounts_number_seq;
CREATE TABLE accounts (
number int DEFAULT nextval('accounts_number_seq')
);
```
Maybe something like that.... One tricky part is I don't think the crystal DB allows you to run multiple statements at once. We may need https://github.com/will/crystal-pg/pull/253 to be implemented before this can be done...
Contributor guide
Research direction
Start by reading related issues #910 and #797, then review crystal-pg pull request #253 because the issue identifies multiple statements as a constraint. Done means the `default: :sequence` column helper creates the sequence, creates the column, and assigns the sequence as its default in PostgreSQL.
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
- 35/100