Method: ActiveRecord::Tasks::MySQLDatabaseTasks#structure_dump

Defined in:
lib/active_record/tasks/mysql_database_tasks.rb

#structure_dump(filename, extra_flags) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/active_record/tasks/mysql_database_tasks.rb', line 43

def structure_dump(filename, extra_flags)
  args = prepare_command_options
  args.concat(["--result-file", "#{filename}"])
  args.concat(["--no-data"])
  args.concat(["--routines"])
  args.concat(["--skip-comments"])

  ignore_tables = ActiveRecord::SchemaDumper.ignore_tables
  if ignore_tables.any?
    args += ignore_tables.map { |table| "--ignore-table=#{db_config.database}.#{table}" }
  end

  args.concat([db_config.database.to_s])
  args.unshift(*extra_flags) if extra_flags

  run_cmd("mysqldump", args, "dumping")
end