Sha256: 6a83e6d66e3255006d138a39d000c907311bdba6badbfee94a53f6a79de13ae2

Contents?: true

Size: 937 Bytes

Versions: 4

Compression:

Stored size: 937 Bytes

Contents

# connect to the database and setup the schema
require "active_record"
require "yaml"
abc = YAML.load_file("config/database.yml")
ActiveRecord::Base.establish_connection(abc["test"])

# Remove after migration to Rails 5
ActiveRecord::Base.raise_in_transactional_callbacks = true

ActiveRecord::Base.logger = Logger.new("log/test.log")

ActiveRecord::Schema.define do
  self.verbose = false

  execute "DROP SCHEMA public CASCADE;"
  execute "CREATE SCHEMA public;"
  execute "CREATE EXTENSION IF NOT EXISTS hstore;"

  execute <<-SQL
    DROP TYPE IF EXISTS access_level;
    CREATE TYPE access_level AS ENUM (
        'private',
        'company',
        'viewable',
        'accessible'
    );
  SQL

  create_table :users, force: true do |t|
    t.integer   :role_id
    t.string    :first_name
    t.string    :last_name
    t.hstore    :meta_data
    t.column    :access_level, :access_level

    t.timestamps null: true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple-sql-0.3.1 spec/support/001_database.rb
simple-sql-0.2.8 spec/support/001_database.rb
simple-sql-0.3.0 spec/support/001_database.rb
simple-sql-0.2.7 spec/support/001_database.rb