Sha256: 912c46168b06faef56924d3e0bd2c1f1a6183cf3e2871df0e1cc8649349b992e
Contents?: true
Size: 680 Bytes
Versions: 1
Compression:
Stored size: 680 Bytes
Contents
require 'erb' require 'yaml' require 'active_record' config_file = File.expand_path('../../database.yml', __FILE__) config = YAML::load(ERB.new(IO.read(config_file)).result)['db'] ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres')) ActiveRecord::Base.connection.drop_database(config['database']) ActiveRecord::Base.connection.create_database(config['database']) ActiveRecord::Base.establish_connection(config) ActiveRecord::Base.connection.create_table :users do |t| t.string :type t.string :name, null: false t.integer :age, null: false t.date :birth_date, null: false t.boolean :disabled, null: false, default: false t.timestamps end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_record-pg_generate_series-0.1.0 | bin/db_setup.rb |