From 19799d7bb5fc256146c6eb0f6bb9eee1c207fcbe Mon Sep 17 00:00:00 2001 From: iamrubydevi Date: Wed, 1 Nov 2023 16:06:50 +0530 Subject: [PATCH] Database migration and gem update --- .gitignore | 1 + Gemfile | 1 + Gemfile.lock | 5 +++++ db/schema.rb | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 db/schema.rb diff --git a/.gitignore b/.gitignore index 7e6b54f..dadea69 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ # Ignore master key for decrypting credentials and more. /config/master.key +.env \ No newline at end of file diff --git a/Gemfile b/Gemfile index f3f4472..4509a6c 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'bootsnap', require: false group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem 'debug', platforms: %i[mri windows] + gem 'dotenv-rails' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 83f6b04..f91b864 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,6 +87,10 @@ GEM irb (>= 1.5.0) reline (>= 0.3.1) diff-lcs (1.5.0) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) + railties (>= 3.2) drb (2.1.1) ruby2_keywords erubi (1.12.0) @@ -215,6 +219,7 @@ PLATFORMS DEPENDENCIES bootsnap debug + dotenv-rails pg (~> 1.1) puma (>= 5.0) rails (~> 7.1.1) diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..8046a5e --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,53 @@ +# 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 `bin/rails +# db:schema:load`. When creating a new database, `bin/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[7.1].define(version: 2023_11_01_102104) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "aeroplanes", force: :cascade do |t| + t.string "name" + t.string "model" + t.string "image" + t.string "description" + t.integer "number_of_seats" + t.string "location" + t.decimal "fee" + t.boolean "reserved" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "reservations", force: :cascade do |t| + t.date "reserved_date" + t.date "start_time" + t.date "end_time" + t.decimal "total_cost" + t.string "start_location" + t.string "destination" + t.bigint "user_id", null: false + t.bigint "aeroplane_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["aeroplane_id"], name: "index_reservations_on_aeroplane_id" + t.index ["user_id"], name: "index_reservations_on_user_id" + end + + create_table "users", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_foreign_key "reservations", "aeroplanes" + add_foreign_key "reservations", "users" +end