Sha256: 1c75ea0f5a21e0180480b332a8947b543554ac9f6b646f6058d89f8fb741d289

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

$:.unshift(File.expand_path("../lib", __dir__))

# require "bundler/setup"
# Bundler.require :development

require "active_record"
# This allows playing with the rake task as well. Ex:
#
#     ActiveRecord::Tasks::DatabaseTasks.
#       structure_load(Post.connection_db_config, "awesome-file.sql")
require "active_record/connection_adapters/cockroachdb/database_tasks"

schema_kind = ENV.fetch("SCHEMA_KIND", ENV.fetch("SCHEMA", "default"))

system("cockroach sql --insecure --host=localhost:26257 --execute='drop database if exists ar_crdb_console'",
  exception: true)
system("cockroach sql --insecure --host=localhost:26257 --execute='create database ar_crdb_console'",
  exception: true)

ActiveRecord::Base.establish_connection(
  #Alternative version:  "cockroachdb://root@localhost:26257/ar_crdb_console"
  adapter: "cockroachdb",
  host: "localhost",
  port: 26257,
  user: "root",
  database: "ar_crdb_console"
)

load "#{__dir__}/console_schemas/#{schema_kind}.rb"

require "irb"
IRB.start(__FILE__)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-cockroachdb-adapter-7.1.1 bin/console