Last active
September 20, 2017 13:36
-
-
Save asenchi/d2e7be622eb732a329fd8db6e467fd2d to your computer and use it in GitHub Desktop.
Specifying schemas in Sequel 5 migrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- How do I do this in Sequel? | |
# CREATE SCHEMA IF NOT EXISTS mine | |
# CREATE TABLE test (name text); | |
# in Sequel (old way) | |
Sequel.migration do | |
up do | |
run "CREATE SCHEMA IF NOT EXISTS mine;" | |
create_table(:mine__test) do | |
column :name, :text | |
end | |
end | |
end | |
# in Sequel 5 (new way) | |
Sequel.migration do | |
up do | |
run "CREATE SCHEMA IF NOT EXISTS mine;" | |
create_table(Sequel.qualify(:mine, :test)) do | |
column :name, :text | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment