Class: ActiveRecord::ConnectionAdapters::BigqueryAdapter::TableDefinition
- Inherits:
-
TableDefinition
- Object
- TableDefinition
- ActiveRecord::ConnectionAdapters::BigqueryAdapter::TableDefinition
- Defined in:
- lib/active_record/connection_adapters/bigquery_adapter.rb
Instance Method Summary collapse
- #primary_key(name, type = :primary_key, options = {}) ⇒ Object
- #record(*args) ⇒ Object
- #references(*args) ⇒ Object
- #timestamps(*args) ⇒ Object
Instance Method Details
#primary_key(name, type = :primary_key, options = {}) ⇒ Object
390 391 392 |
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 390 def primary_key(name, type = :primary_key, = {}) return column name, :string, end |
#record(*args) ⇒ Object
394 395 396 397 |
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 394 def record(*args) = args. column(:created_at, :record, ) end |
#references(*args) ⇒ Object
405 406 407 408 409 410 411 412 413 414 |
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 405 def references(*args) = args. polymorphic = .delete(:polymorphic) = .delete(:index) args.each do |col| column("#{col}_id", :string, ) column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : ) if polymorphic index(polymorphic ? %w(id type).map { |t| "#{col}_#{t}" } : "#{col}_id", .is_a?(Hash) ? : {}) if end end |
#timestamps(*args) ⇒ Object
399 400 401 402 403 |
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 399 def (*args) = args. column(:created_at, :timestamp, ) column(:updated_at, :timestamp, ) end |