diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-04 10:20:01 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-04 10:20:01 -0600 |
| commit | 3b2168000296da591908139f49ae82e2bfe6e2a2 (patch) | |
| tree | 71ed6347e8e6c1ce1c985269e44c837cc8ee0604 | |
| parent | eb5c0deaf546834e1a46d258f8c7bddd7f21508f (diff) | |
Connect rails to existing db
| -rw-r--r-- | course/Gemfile | 2 | ||||
| -rw-r--r-- | course/Gemfile.lock | 183 | ||||
| -rw-r--r-- | course/config/database.yml | 22 | ||||
| -rw-r--r-- | course/db/schema.rb | 89 |
4 files changed, 278 insertions, 18 deletions
diff --git a/course/Gemfile b/course/Gemfile index bc06921..e3368b2 100644 --- a/course/Gemfile +++ b/course/Gemfile @@ -19,7 +19,7 @@ gem 'jbuilder', '~> 2.7' # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' - +gem 'pg' # Use Active Storage variant # gem 'image_processing', '~> 1.2' diff --git a/course/Gemfile.lock b/course/Gemfile.lock new file mode 100644 index 0000000..a6088a5 --- /dev/null +++ b/course/Gemfile.lock @@ -0,0 +1,183 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + mail (>= 2.7.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + nokogiri (>= 1.8.5) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) + globalid (>= 0.3.6) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + marcel (~> 0.3.1) + activesupport (6.0.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + bindex (0.8.1) + bootsnap (1.4.6) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.1.3) + concurrent-ruby (1.1.6) + crass (1.0.6) + erubi (1.9.0) + ffi (1.12.2) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + jbuilder (2.10.0) + activesupport (>= 5.0.0) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.5) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + msgpack (1.3.3) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + pg (1.2.2) + puma (4.3.3) + nio4r (~> 2.0) + rack (2.2.2) + rack-proxy (0.6.5) + rack + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + bundler (>= 1.3.0) + railties (= 6.0.2.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rake (13.0.1) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) + ffi (~> 1.0) + ruby_dep (1.5.0) + sprockets (4.0.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.0.1) + thread_safe (0.3.6) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (1.2.7) + thread_safe (~> 0.1) + web-console (4.0.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + webpacker (4.2.2) + activesupport (>= 4.2) + rack-proxy (>= 0.6.1) + railties (>= 4.2) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + bootsnap (>= 1.4.2) + byebug + jbuilder (~> 2.7) + listen (>= 3.0.5, < 3.2) + pg + puma (~> 4.1) + rails (~> 6.0.2, >= 6.0.2.2) + sqlite3 (~> 1.4) + turbolinks (~> 5) + tzinfo-data + web-console (>= 3.3.0) + webpacker (~> 4.0) + +RUBY VERSION + ruby 2.7.0p0 + +BUNDLED WITH + 2.1.4 diff --git a/course/config/database.yml b/course/config/database.yml index 4a8a1b2..f503be3 100644 --- a/course/config/database.yml +++ b/course/config/database.yml @@ -1,25 +1,13 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# default: &default - adapter: sqlite3 + adapter: postgresql + encoding: unicode + host: <%= File.join(Dir.pwd, '../tmp/sockets') %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 development: <<: *default - database: db/development.sqlite3 + database: course -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 + database: course_test diff --git a/course/db/schema.rb b/course/db/schema.rb new file mode 100644 index 0000000..537983f --- /dev/null +++ b/course/db/schema.rb @@ -0,0 +1,89 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `rails +# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "account", id: :bigint, default: nil, force: :cascade do |t| + t.text "name", null: false + t.decimal "amount", precision: 10, scale: 2, null: false + t.index ["id", "name"], name: "account_id_name_idx" + end + + create_table "guard_on_duty", id: false, force: :cascade do |t| + t.text "prison", null: false + t.text "guard", null: false + end + + create_table "part", id: false, force: :cascade do |t| + t.bigint "id", null: false + t.datetime "created_at", null: false + t.text "data" + end + + create_table "part_2018", id: false, force: :cascade do |t| + t.bigint "id", null: false + t.datetime "created_at", null: false + t.text "data" + end + + create_table "part_2019", id: false, force: :cascade do |t| + t.bigint "id", null: false + t.datetime "created_at", null: false + t.text "data" + end + + create_table "part_2020", id: false, force: :cascade do |t| + t.bigint "id", null: false + t.datetime "created_at", null: false + t.text "data" + end + + create_table "part_2021", id: false, force: :cascade do |t| + t.bigint "id", null: false + t.datetime "created_at", null: false + t.text "data" + end + + create_table "pgbench_accounts", primary_key: "aid", id: :integer, default: nil, force: :cascade do |t| + t.integer "bid" + t.integer "abalance" + t.string "filler", limit: 84 + end + + create_table "pgbench_branches", primary_key: "bid", id: :integer, default: nil, force: :cascade do |t| + t.integer "bbalance" + t.string "filler", limit: 88 + end + + create_table "pgbench_history", id: false, force: :cascade do |t| + t.integer "tid" + t.integer "bid" + t.integer "aid" + t.integer "delta" + t.datetime "mtime" + t.string "filler", limit: 22 + end + + create_table "pgbench_tellers", primary_key: "tid", id: :integer, default: nil, force: :cascade do |t| + t.integer "bid" + t.integer "tbalance" + t.string "filler", limit: 84 + end + + create_table "waltest", id: false, force: :cascade do |t| + t.integer "id" + end + +end |
