Skip to content

Instantly share code, notes, and snippets.

View nitinstp23's full-sized avatar
:octocat:

Nitin Misra nitinstp23

:octocat:
View GitHub Profile
@nitinstp23
nitinstp23 / truncate_rails_tables.rb
Created July 22, 2020 18:30 — forked from romanblick/truncate_rails_tables.rb
Truncate all tables in rails
ActiveRecord::Base.establish_connection
ActiveRecord::Base.connection.tables.each do |table|
next if table == 'schema_migrations'
case ActiveRecord::Base.connection.adapter_name.downcase.to_sym
when :mysql2 || :postgresql
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
when :sqlite
ActiveRecord::Base.connection.execute("DELETE FROM #{table}")
end
package main
import "fmt"
type Question struct {
description string
qType string
options []string
}