As I recently mentioned on Discord, I’ve been enjoying exploring using Sequel (a Ruby-based ORM that’s an alternative to Active Record), and one of the things I had been worried about—how easy it is to work with migrations—turns out to be pretty nifty.
An example migration from a project I’m working on:
Sequel.migration do
change do
create_table(:workflows) do
primary_key :id
foreign_key :site_id, :sites
String :emoji
String :name, null: false
String :kind, null: false # requires `plugin :enum`
String :params, null: false
Integer :order, default: 0
DateTime :created_at
DateTime :updated_at
end
end
end
Definitely the hardest part was figuring out how I want to handle DB configuration and the Rake tasks to kick off migrations, but in the end it was a “sweet solution”. 😏
I don’t know if I’ll feel confident enough to offer a “bridgetown-sequel” plugin in the very near future, but a tutorial to get up and running on a project? Definitely.
You must log in or register to comment.