Module: Sequel::JDBC::H2::DatabaseMethods
- Defined in:
- lib/sequel_core/adapters/jdbc/h2.rb
Overview
Instance methods for H2 Database objects accessed via JDBC.
Instance Method Summary collapse
-
#alter_table_sql(table, op) ⇒ Object
H2 needs to add a primary key column as a constraint.
-
#dataset(opts = nil) ⇒ Object
Return Sequel::JDBC::H2::Dataset object with the given opts.
-
#serial_primary_key_options ⇒ Object
H2 uses an IDENTITY type.
Instance Method Details
#alter_table_sql(table, op) ⇒ Object
H2 needs to add a primary key column as a constraint
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sequel_core/adapters/jdbc/h2.rb', line 10 def alter_table_sql(table, op) case op[:op] when :add_column if op.delete(:primary_key) sql = super(table, op) [sql, "ALTER TABLE #{quote_schema_table(table)} ADD PRIMARY KEY (#{quote_identifier(op[:name])})"] else super(table, op) end else super(table, op) end end |
#dataset(opts = nil) ⇒ Object
Return Sequel::JDBC::H2::Dataset object with the given opts.
25 26 27 |
# File 'lib/sequel_core/adapters/jdbc/h2.rb', line 25 def dataset(opts=nil) Sequel::JDBC::H2::Dataset.new(self, opts) end |
#serial_primary_key_options ⇒ Object
H2 uses an IDENTITY type
30 31 32 |
# File 'lib/sequel_core/adapters/jdbc/h2.rb', line 30 def {:primary_key => true, :type => :identity} end |