class TokyoMetro::Rake::Rails::Deploy::Heroku::Csv::Command::ExportFromSqlite

SQLite から export する table

Private Instance Methods

first_settings() click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/export_from_sqlite.rb, line 16
def first_settings
  [ ".mode csv" , ".header off" ]
end
optional_setting_of_initializer() click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/export_from_sqlite.rb, line 6
def optional_setting_of_initializer
  @letter_code = "utf8"
  # @dirname = ".import ./../rails_tokyo_metro_db/csv/#{ @time }/#{ @letter_code }/#{ table }.csv #{ table }"
  @dirname = "#{ ::Rails.root }/db/csv/#{ @time }/#{ @letter_code }"
end
set_commands_for_db() click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/export_from_sqlite.rb, line 25
def set_commands_for_db
  @commands << tables_names_added_to_db.map { | table |
    [
      ".output #{ @dirname }/#{ table }.csv" ,
      "select * from #{ table };"
    ]
  }
end
set_time( time ) click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/export_from_sqlite.rb, line 12
def set_time( time )
  super( time , require_time: false )
end
tables_names_added_to_db() click to toggle source

@note 「schema_migrations 以外の table から、# で始まるものを取り除いたもの」

# File lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/export_from_sqlite.rb, line 21
def tables_names_added_to_db
  tables_without_schema_migrations.delete_if( &:begin_with_sharp? ).map( &:to_s )
end