Skip to content

Instantly share code, notes, and snippets.

@asenchi
Last active September 20, 2017 13:36
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 asenchi/d2e7be622eb732a329fd8db6e467fd2d to your computer and use it in GitHub Desktop.
Save asenchi/d2e7be622eb732a329fd8db6e467fd2d to your computer and use it in GitHub Desktop.
Specifying schemas in Sequel 5 migrations
# -- 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