From 8e15dbd73035c2a2198a2828a20ddcebe0739823 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 3 Jul 2018 13:58:57 -0400 Subject: Implemented streams Currently there are no links to the pages for editing stream updates, and the admin panel for managing streams could probably have a better look & feel, but here's some basic working functionality. refs #8 --- db/migrate/20180702220722_create_streams.rb | 11 +++++++++++ db/migrate/20180702221133_create_updates.rb | 10 ++++++++++ db/schema.rb | 19 ++++++++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180702220722_create_streams.rb create mode 100644 db/migrate/20180702221133_create_updates.rb (limited to 'db') diff --git a/db/migrate/20180702220722_create_streams.rb b/db/migrate/20180702220722_create_streams.rb new file mode 100644 index 0000000..bb8255e --- /dev/null +++ b/db/migrate/20180702220722_create_streams.rb @@ -0,0 +1,11 @@ +class CreateStreams < ActiveRecord::Migration[5.1] + def change + create_table :streams do |t| + t.string :title + t.text :body + t.string :slug + + t.timestamps + end + end +end diff --git a/db/migrate/20180702221133_create_updates.rb b/db/migrate/20180702221133_create_updates.rb new file mode 100644 index 0000000..05cc35a --- /dev/null +++ b/db/migrate/20180702221133_create_updates.rb @@ -0,0 +1,10 @@ +class CreateUpdates < ActiveRecord::Migration[5.1] + def change + create_table :updates do |t| + t.references :stream, foreign_key: true + t.text :body + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e036b75..2ca0b58 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180702214240) do +ActiveRecord::Schema.define(version: 20180702221133) do create_table "blogs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin" do |t| t.string "title" @@ -228,6 +228,22 @@ ActiveRecord::Schema.define(version: 20180702214240) do t.index ["recordable_type", "recordable_id"], name: "index_records_on_recordable_type_and_recordable_id" end + create_table "streams", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| + t.string "title" + t.text "body" + t.string "slug" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "updates", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| + t.bigint "stream_id" + t.text "body" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["stream_id"], name: "index_updates_on_stream_id" + end + create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin" do |t| t.string "login", default: "", null: false t.string "email", default: "", null: false @@ -253,4 +269,5 @@ ActiveRecord::Schema.define(version: 20180702214240) do add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_trainers", column: "trainer_id" add_foreign_key "pokeviewer_pokemon", "pokeviewer_revisions", column: "current_id" add_foreign_key "pokeviewer_revisions", "pokeviewer_species", column: "species_id" + add_foreign_key "updates", "streams" end -- cgit 1.4.1