diff --git a/Gemfile.lock b/Gemfile.lock index 9589226d..677b166c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,50 +1,49 @@ GEM remote: https://rubygems.org/ specs: - activemodel (6.0.3.1) - activesupport (= 6.0.3.1) - activerecord (6.0.3.1) - activemodel (= 6.0.3.1) - activesupport (= 6.0.3.1) - activesupport (6.0.3.1) + activemodel (6.1.3) + activesupport (= 6.1.3) + activerecord (6.1.3) + activemodel (= 6.1.3) + activesupport (= 6.1.3) + activesupport (6.1.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - coderay (1.1.1) - concurrent-ruby (1.1.6) - i18n (1.8.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + coderay (1.1.3) + concurrent-ruby (1.1.8) + i18n (1.8.9) concurrent-ruby (~> 1.0) - method_source (0.8.2) - minitest (5.14.1) - mustermann (1.0.3) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) + method_source (1.0.0) + minitest (5.14.4) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + pry (0.14.0) + coderay (~> 1.1) + method_source (~> 1.0) rack (2.2.3) - rack-protection (2.0.7) + rack-protection (2.1.0) rack - require_all (1.3.3) - sinatra (2.0.7) + require_all (3.0.0) + ruby2_keywords (0.0.4) + sinatra (2.1.0) mustermann (~> 1.0) - rack (~> 2.0) - rack-protection (= 2.0.7) + rack (~> 2.2) + rack-protection (= 2.1.0) tilt (~> 2.0) - sinatra-activerecord (2.0.12) - activerecord (>= 3.2) + sinatra-activerecord (2.0.22) + activerecord (>= 4.1) sinatra (>= 1.0) - slop (3.6.0) - sqlite3 (1.3.13) - thread_safe (0.3.6) + sqlite3 (1.4.2) tilt (2.0.10) - tzinfo (1.2.7) - thread_safe (~> 0.1) - zeitwerk (2.3.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + zeitwerk (2.4.2) PLATFORMS - ruby + x86_64-darwin-20 DEPENDENCIES pry @@ -53,4 +52,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 1.14.6 + 2.2.13 diff --git a/app/models/guest.rb b/app/models/guest.rb new file mode 100644 index 00000000..99aba379 --- /dev/null +++ b/app/models/guest.rb @@ -0,0 +1,2 @@ +class Guest < ActiveRecord::Base +end diff --git a/app/models/theater.rb b/app/models/theater.rb new file mode 100644 index 00000000..e69de29b diff --git a/bin/run.rb b/bin/program.rb similarity index 68% rename from bin/run.rb rename to bin/program.rb index cf08c338..204ce571 100644 --- a/bin/run.rb +++ b/bin/program.rb @@ -1,5 +1,6 @@ +require 'pry' require_relative '../config/environment' - +# binding.pry puts "HELLO WORLD" diff --git a/config/environment.rb b/config/environment.rb index 4dbe13e5..92ed3339 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,9 @@ require 'bundler' Bundler.require -ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/development.db') -require_all 'lib' +ActiveRecord::Base.establish_connection( + :adapter => "sqlite3", + :database => "db/development.sqlite" +) + +require_all 'app' diff --git a/db/development.sqlite b/db/development.sqlite new file mode 100644 index 00000000..e69de29b diff --git a/db/migrate/20210308201358_create_guests.rb b/db/migrate/20210308201358_create_guests.rb new file mode 100644 index 00000000..9182d453 --- /dev/null +++ b/db/migrate/20210308201358_create_guests.rb @@ -0,0 +1,9 @@ +class CreateGuests < ActiveRecord::Migration[6.1] + + def change + create_table :guests do |t| + t.string :name + t.integer :age + end + end +end diff --git a/db/migrate/20210308205332_create_theaters.rb b/db/migrate/20210308205332_create_theaters.rb new file mode 100644 index 00000000..28d964de --- /dev/null +++ b/db/migrate/20210308205332_create_theaters.rb @@ -0,0 +1,9 @@ +class CreateTheaters < ActiveRecord::Migration[6.1] + def change + create_table :theaters do |t| + t.string :name + t.string :viewing_room + # t.integer :seats + end + end +end diff --git a/db/migrate/20210308205351_create_genres.rb b/db/migrate/20210308205351_create_genres.rb new file mode 100644 index 00000000..c4b1b1ce --- /dev/null +++ b/db/migrate/20210308205351_create_genres.rb @@ -0,0 +1,7 @@ +class CreateGenres < ActiveRecord::Migration[6.1] + def change + create_table :genres do |t| + t.string :genre + end + end +end diff --git a/db/migrate/20210308205403_create_movies.rb b/db/migrate/20210308205403_create_movies.rb new file mode 100644 index 00000000..5cd3d625 --- /dev/null +++ b/db/migrate/20210308205403_create_movies.rb @@ -0,0 +1,9 @@ +class CreateMovies < ActiveRecord::Migration[6.1] + def change + create_table :movies do |t| + t.string :title + t.integer :showtime + t.integer :age_rating + end + end +end diff --git a/db/migrate/20210308205440_create_ticketpurchases.rb b/db/migrate/20210308205440_create_ticketpurchases.rb new file mode 100644 index 00000000..a7c2baf0 --- /dev/null +++ b/db/migrate/20210308205440_create_ticketpurchases.rb @@ -0,0 +1,11 @@ +class CreateTicketpurchases < ActiveRecord::Migration[6.1] + def change + create_table :ticketpurchases do |t| + t.integer :guest_id + t.string :viewing_room + t.integer :movie_id + t.integer :showtime + t.integer :ticket_price + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..5cc751a5 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,43 @@ +# 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.define(version: 2021_03_08_205440) do + + create_table "genres", force: :cascade do |t| + t.string "genre" + end + + create_table "guests", force: :cascade do |t| + t.string "name" + t.integer "age" + end + + create_table "movies", force: :cascade do |t| + t.string "title" + t.integer "showtime" + t.integer "age_rating" + end + + create_table "theaters", force: :cascade do |t| + t.string "name" + t.string "viewing_room" + end + + create_table "ticketpurchases", force: :cascade do |t| + t.string "guest_id" + t.string "viewing_room" + t.string "movie_id" + t.integer "showtime" + t.integer "ticket_price" + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000..b4c32ce4 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,5 @@ +# require_relative './config/environment.rb' + +Guest.destroy_all + +g1 = Guest.create(name: "Hadi", age: 28) \ No newline at end of file