Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand migration generator to support special behavior for create_ prefix #205

Open
cllns opened this issue Jul 14, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@cllns
Copy link
Member

cllns commented Jul 14, 2024

Right now (er, once #201 is merged), regardless of the name of the migration, it just gets created as an empty migration:

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:

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:

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

@cllns cllns added the enhancement New feature or request label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant