Expand migration generator to support special behavior for create_ prefix
- Dominant language
- Ruby
- Stars
- 33
- Forks
- 55
- Avg merge
- 8d 7h
- Merged PRs (30d)
- 2
Description
Right now (er, once #201 is merged), regardless of the name of the migration, it just gets created as an empty migration:
```ruby
ROM::SQL.migration do
# Add your migration here.
#
# See https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html for details.
end
```
We should be a little bit smarter than that, and if someone does `hanami generate migration create_books`, it should create something like this:
```ruby
ROM::SQL.migration do
change do
create_table :books do
primary_key :id
end
end
# Reference https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html
end
```
And, going further we could also support something lke: `hanami generate migration create_books name description quantity:int`:
```ruby
ROM::SQL.migration do
change do
create_table :books do
primary_key :id
String :name
String :description
Integer :quantity
end
end
# Reference https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html
end
```
And we could later expand to things like `name:not_null`, but let's not be too ambitious with this first enhancement
Contributor guide
Assessment
This issue has not been assessed yet.