Skip to content

Instantly share code, notes, and snippets.

@gpherguson
Created August 19, 2014 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpherguson/b8c70b41598b6817db61 to your computer and use it in GitHub Desktop.
Save gpherguson/b8c70b41598b6817db61 to your computer and use it in GitHub Desktop.
create_table(:pairs) do
primary_key :id
foreign_key :left_leaf_id, :leafs, :key => :id
foreign_key :right_leaf_id, :leafs, :key => :id
String :description
FalseClass :enabled
Time :created_at, :null => false, :index => true
Time :modified_at, :null => false, :index => true
# constraint(:pair_ids_unique, Sequel.function{pairs__left_leaf_id != pairs__right_leaf_id})
# constraint(:pair_ids_unique, Sequel.function(pairs__left_leaf_id != pairs__right_leaf_id))
# constraint(:pair_ids_unique, Sequel.function(left_leaf_id != right_leaf_id))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment