-2

How to write migration create table with options like DISTRIBUTE BY HASH(id) for Sequel

Example in Ruby

create_table(:table_name) do
  primary_key :id
  column :column_name, :text
end

Вesired result in SQL

CREATE TABLE "table_name" (
  "id" serial PRIMARY KEY,
  "column_name" text,
) DISTRIBUTE BY HASH(id);
Andrew Zhuk
  • 464
  • 8
  • 22

1 Answers1

1

Sequel doesn't have code that generates that SQL, so you need to use run:

run(<<END)
CREATE TABLE "table_name" (
  "id" serial PRIMARY KEY,
  "column_name" text,
) DISTRIBUTE BY HASH(id);
END
Jeremy Evans
  • 11,361
  • 23
  • 25
  • Yes, I looked at the source code and did not see that it was possible to implement this, thanks J.E. maybe you do this functionality :-) – Andrew Zhuk Feb 09 '18 at 17:34