udemy-go-web-2/migrations/20210630180628_create_widgets_table.up.fizz
2024-08-07 15:51:25 +02:00

12 lines
562 B
Plaintext

create_table("widgets") {
t.Column("id", "integer", {primary: true})
t.Column("name", "string", {"default": ""})
t.Column("description", "text", {"default": ""})
t.Column("inventory_level", "integer", {})
t.Column("price", "integer", {})
}
sql("alter table widgets alter column created_at set default now();")
sql("alter table widgets alter column updated_at set default now();")
sql("insert into widgets (name, description, inventory_level, price, created_at, updated_at) values ('Widget', 'A very nice widget.', 10, 1000, now(), now());")