Sha256: be55d425e6228c619d2a3ddc33b9165f0163825afa1fadb5b1c47a8ffc35cc0b

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

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", "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.0 bin/console