Sha256: 77d4f1a60413e80dd350c4cde8ce1a9dfcdd2b90919448a95f5f4d59495232b8
Contents?: true
Size: 996 Bytes
Versions: 15
Compression:
Stored size: 996 Bytes
Contents
require 'active_record' class PGInitializer def self.initialize! config = { 'adapter' => 'postgresql', 'encoding' => 'unicode', 'database' => 'superstore_test', 'pool' => 5, 'host' => 'localhost' } ActiveRecord::Base.configurations = { test: config } ActiveRecord::Tasks::DatabaseTasks.drop config ActiveRecord::Tasks::DatabaseTasks.create config ActiveRecord::Base.establish_connection config create_labels_table create_users_table end def self.create_labels_table ActiveRecord::Migration.create_table :labels do |t| t.string :issue_id, null: false t.string :name, null: false end end def self.create_users_table ActiveRecord::Migration.create_table :users do |t| t.string :special_id, null: false t.index :special_id, unique: true end end def self.table_names %w(labels users) end end PGInitializer.initialize! ActiveRecord::Migration.verbose = false
Version data entries
15 entries across 15 versions & 1 rubygems