Module: Rails::Snowflake::TableDefinition
- Defined in:
- lib/rails/snowflake/table_definition.rb
Instance Method Summary collapse
- #primary_key(name, type = :primary_key, **options) ⇒ Object
- #snowflake(column_name, **options) ⇒ Object
Instance Method Details
#primary_key(name, type = :primary_key, **options) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/rails/snowflake/table_definition.rb', line 6 def primary_key(name, type = :primary_key, **) if type == :snowflake [:default] = snowflake_default_function end super end |
#snowflake(column_name, **options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rails/snowflake/table_definition.rb', line 14 def snowflake(column_name, **) if column_name == :id raise Error, "Cannot use t.snowflake :id directly. Use `create_table :table_name, id: :snowflake` instead." end unless @name raise Error, "Could not determine table name for Snowflake column. Make sure you're using it within a `create_table` block." end [:default] = snowflake_default_function [:index] ||= true column(column_name, :snowflake, **) end |