mirror of
https://github.com/iv-org/invidious.git
synced 2024-06-07 19:40:52 +00:00
Run crystal format
This commit is contained in:
parent
559d3e32c4
commit
4eee5cf70f
@ -15,12 +15,11 @@ class Invidious::Database::Migrator
|
||||
.each do |migration|
|
||||
next if versions.includes?(migration.version)
|
||||
|
||||
|
||||
if !backed_up
|
||||
puts "New migration(s) found: creating database backup"
|
||||
back_up_database
|
||||
backed_up = true
|
||||
end
|
||||
end
|
||||
|
||||
puts "Running migration: #{migration.class.name}"
|
||||
migration.migrate
|
||||
@ -60,13 +59,13 @@ class Invidious::Database::Migrator
|
||||
SELECT tablename FROM pg_catalog.pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
SQL
|
||||
|
||||
|
||||
table_names = @db.query_all(table_names_request, as: String)
|
||||
|
||||
table_names.try &.each do |name|
|
||||
copy_table(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private def copy_table(table_name : String)
|
||||
@db.exec <<-SQL
|
||||
@ -76,11 +75,10 @@ class Invidious::Database::Migrator
|
||||
SQL
|
||||
|
||||
@db.exec("DROP TABLE backup.#{table_name}")
|
||||
|
||||
|
||||
@db.exec <<-SQL
|
||||
SELECT * INTO backup.#{table_name}
|
||||
FROM public.#{table_name}
|
||||
SQL
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user