Sequel.migration do change do create_table(:sources) do foreign_key :entity_id, :entities, null: false foreign_key :source_id, :entities, null: false DateTime :created_at, null: false DateTime :updated_at unique %i[entity_id source_id] end create_table(:notes) do foreign_key :entity_id, :entities, null: false String :text, text: true DateTime :created_at, null: false DateTime :updated_at end end end