amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 206 forks source link

Scaffold CLI to support Postgresql array and JSON types #1249

Open rnice01 opened 3 years ago

rnice01 commented 3 years ago

Description

Are you guys open to having the scaffolding CLI support Postgresql specific types? It's easy enough to change the generated files as of now, but this might be a nice quality of life feature?

Example amber g scaffold Vocab expression:string meanings:array:string would produce the following migration and model.

CREATE TABLE vocabs (
  id BIGSERIAL PRIMARY KEY,
  expression VARCHAR,
  meanings VARCHAR[]
class Vocab < Granite::Base
  connection pg
  table vocabs
  column id : Int64, primary: true
  column expression : String?
  column meanings : Array(String)
  timestamps
end
eliasjpr commented 3 years ago

We will be open please follow up with a PR