Method: Sequel::SchemaDumper#dump_table_schema
- Defined in:
- lib/sequel/extensions/schema_dumper.rb
#dump_table_schema(table, options = OPTS) ⇒ Object
Return a string with a create table block that will recreate the given table’s schema. Takes the same options as dump_schema_migration.
166 167 168 169 170 |
# File 'lib/sequel/extensions/schema_dumper.rb', line 166 def dump_table_schema(table, =OPTS) gen = dump_table_generator(table, ) commands = [gen.dump_columns, gen.dump_constraints, gen.dump_indexes].reject{|x| x == ''}.join("\n\n") "create_table(#{table.inspect}#{", #{IGNORE_INDEX_ERRORS_KEY}true" if ![:same_db] && [:indexes] != false && !gen.indexes.empty?}) do\n#{commands.gsub(/^/, ' ')}\nend" end |