Skip to content

Commit

Permalink
chore: improve table dropping code
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 11, 2018
1 parent bac3b12 commit 2174b21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions script/seed-matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

$LOAD_PATH.unshift './lib'
$LOAD_PATH.unshift './spec'
$LOAD_PATH.unshift './tasks'
ENV['RACK_ENV'] = 'development'
require 'sequel'
require 'logger'
Expand Down
1 change: 1 addition & 0 deletions tasks/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def drop_tables
ordered_tables.each do | table_name |
database.drop_table(table_name, cascade: psql?)
end
database.drop_table(:schema_migrations)
end

def drop_views
Expand Down
2 changes: 1 addition & 1 deletion tasks/database/table_dependency_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def call
.collect{|it| @connection.foreign_key_list(it)
.collect{|fk| {from: it, to: fk[:table]} } }
.flatten
.uniq
.uniq - [:schema_migrations]
check(@connection.tables, dependencies, ordered_table_names)
ordered_table_names
end
Expand Down

0 comments on commit 2174b21

Please sign in to comment.