Skip to content

Commit

Permalink
Merge pull request #207 from themarshallproject/develop
Browse files Browse the repository at this point in the history
Update migrations for Rails 5.
  • Loading branch information
GabeIsman authored Sep 26, 2018
2 parents 8109d16 + 5ce6a87 commit 8e1297c
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 82 deletions.
2 changes: 1 addition & 1 deletion db/migrate/20160407222051_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateUsers < ActiveRecord::Migration
class CreateUsers < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :first_name
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160408004451_create_app_settings.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateAppSettings < ActiveRecord::Migration
class CreateAppSettings < ActiveRecord::Migration[4.2]
def change
create_table :app_settings do |t|
t.string :key
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160412162646_create_pages.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreatePages < ActiveRecord::Migration
class CreatePages < ActiveRecord::Migration[4.2]
def change
create_table :pages do |t|
t.text :name
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160415154706_create_changes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateChanges < ActiveRecord::Migration
class CreateChanges < ActiveRecord::Migration[4.2]
def change
create_table :changes do |t|
t.integer :prev_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160415154722_create_slack_integrations.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateSlackIntegrations < ActiveRecord::Migration
class CreateSlackIntegrations < ActiveRecord::Migration[4.2]
def change
create_table :slack_integrations do |t|
t.string :channel
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160415155125_create_subscriptions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateSubscriptions < ActiveRecord::Migration
class CreateSubscriptions < ActiveRecord::Migration[4.2]
def change
create_table :subscriptions do |t|
t.integer :watcher_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160415171122_create_page_snapshots.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreatePageSnapshots < ActiveRecord::Migration
class CreatePageSnapshots < ActiveRecord::Migration[4.2]
def change
create_table :page_snapshots do |t|
t.integer :page_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160415181940_rename_cols_on_changes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class RenameColsOnChanges < ActiveRecord::Migration
class RenameColsOnChanges < ActiveRecord::Migration[4.2]
def change
rename_column :changes, :prev_id, :before_id
rename_column :changes, :prev_type, :before_type
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160417194931_add_hash_to_page_snapshots.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddHashToPageSnapshots < ActiveRecord::Migration
class AddHashToPageSnapshots < ActiveRecord::Migration[4.2]
def change
add_column :page_snapshots, :hash, :string
add_index :page_snapshots, :hash
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160417211247_add_html_to_page_snapshots.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddHtmlToPageSnapshots < ActiveRecord::Migration
class AddHtmlToPageSnapshots < ActiveRecord::Migration[4.2]
def change
add_column :page_snapshots, :html, :text
remove_column :page_snapshots, :s3_url
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160417212750_rename_hash_page_snapshots.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class RenameHashPageSnapshots < ActiveRecord::Migration
class RenameHashPageSnapshots < ActiveRecord::Migration[4.2]
def change
rename_column :page_snapshots, :hash, :sha2_hash
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160418211250_add_summary_to_page_snapshots.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddSummaryToPageSnapshots < ActiveRecord::Migration
class AddSummaryToPageSnapshots < ActiveRecord::Migration[4.2]
def change
add_column :page_snapshots, :text, :string
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20161117114700_create_sqs_integrations.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateSqsIntegrations < ActiveRecord::Migration
class CreateSqsIntegrations < ActiveRecord::Migration[4.2]
def change
create_table :sqs_integrations do |t|
t.text :queue_url
Expand Down
12 changes: 6 additions & 6 deletions db/migrate/20170526193719_add_is_admin_to_user.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class AddIsAdminToUser < ActiveRecord::Migration
class AddIsAdminToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :is_admin, :boolean

# Set new `is_admin` field for users listed in the `ADMIN_EMAILS`
# environment variable, if it exists
emails = ENV['ADMIN_EMAILS'].to_s.split(',')
Expand All @@ -13,19 +13,19 @@ def change
user.is_admin = true
user.save
end

# The below only should apply to people hosting Klaxon themselves rather
# than on Heroku, and only in certain situations.
if emails.empty?
puts <<~EOF
Your ADMIN_EMAILS environment variable was empty.
If you want to be able to delete users from within the Klaxon
Web interface, set up at least one admin user.
The easiest way to do this is to run the "users:create_admin"
Rake task with the ADMIN_EMAILS environment variable set.
EOF
end
end
end
end
119 changes: 56 additions & 63 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: UTF-8
# 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.
Expand All @@ -11,94 +10,88 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170526193719) do
ActiveRecord::Schema.define(version: 2017_05_26_193719) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "app_settings", force: :cascade do |t|
t.string "key"
t.text "value"
create_table "app_settings", id: :serial, force: :cascade do |t|
t.string "key"
t.text "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["key"], name: "index_app_settings_on_key"
end

add_index "app_settings", ["key"], name: "index_app_settings_on_key", using: :btree

create_table "changes", force: :cascade do |t|
t.integer "before_id"
t.string "before_type"
t.integer "after_id"
t.string "after_type"
t.text "summary"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
create_table "changes", id: :serial, force: :cascade do |t|
t.integer "before_id"
t.string "before_type"
t.integer "after_id"
t.string "after_type"
t.text "summary"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["after_id"], name: "index_changes_on_after_id"
t.index ["after_type"], name: "index_changes_on_after_type"
t.index ["before_id"], name: "index_changes_on_before_id"
t.index ["before_type"], name: "index_changes_on_before_type"
end

add_index "changes", ["after_id"], name: "index_changes_on_after_id", using: :btree
add_index "changes", ["after_type"], name: "index_changes_on_after_type", using: :btree
add_index "changes", ["before_id"], name: "index_changes_on_before_id", using: :btree
add_index "changes", ["before_type"], name: "index_changes_on_before_type", using: :btree

create_table "page_snapshots", force: :cascade do |t|
t.integer "page_id"
create_table "page_snapshots", id: :serial, force: :cascade do |t|
t.integer "page_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "sha2_hash"
t.text "html"
t.string "text"
t.string "sha2_hash"
t.text "html"
t.string "text"
t.index ["page_id"], name: "index_page_snapshots_on_page_id"
t.index ["sha2_hash"], name: "index_page_snapshots_on_sha2_hash"
end

add_index "page_snapshots", ["page_id"], name: "index_page_snapshots_on_page_id", using: :btree
add_index "page_snapshots", ["sha2_hash"], name: "index_page_snapshots_on_sha2_hash", using: :btree

create_table "pages", force: :cascade do |t|
t.text "name"
t.text "url"
t.text "css_selector"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
create_table "pages", id: :serial, force: :cascade do |t|
t.text "name"
t.text "url"
t.text "css_selector"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_pages_on_user_id"
end

add_index "pages", ["user_id"], name: "index_pages_on_user_id", using: :btree

create_table "slack_integrations", force: :cascade do |t|
t.string "channel"
t.text "webhook_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
create_table "slack_integrations", id: :serial, force: :cascade do |t|
t.string "channel"
t.text "webhook_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "sqs_integrations", force: :cascade do |t|
t.text "queue_url"
create_table "sqs_integrations", id: :serial, force: :cascade do |t|
t.text "queue_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "subscriptions", force: :cascade do |t|
t.integer "watcher_id"
t.string "watcher_type"
t.integer "watching_id"
t.string "watching_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
create_table "subscriptions", id: :serial, force: :cascade do |t|
t.integer "watcher_id"
t.string "watcher_type"
t.integer "watching_id"
t.string "watching_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["watcher_id"], name: "index_subscriptions_on_watcher_id"
t.index ["watcher_type"], name: "index_subscriptions_on_watcher_type"
t.index ["watching_id"], name: "index_subscriptions_on_watching_id"
t.index ["watching_type"], name: "index_subscriptions_on_watching_type"
end

add_index "subscriptions", ["watcher_id"], name: "index_subscriptions_on_watcher_id", using: :btree
add_index "subscriptions", ["watcher_type"], name: "index_subscriptions_on_watcher_type", using: :btree
add_index "subscriptions", ["watching_id"], name: "index_subscriptions_on_watching_id", using: :btree
add_index "subscriptions", ["watching_type"], name: "index_subscriptions_on_watching_type", using: :btree

create_table "users", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
create_table "users", id: :serial, force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "is_admin"
t.boolean "is_admin"
t.index ["email"], name: "index_users_on_email"
end

add_index "users", ["email"], name: "index_users_on_email", using: :btree

end

0 comments on commit 8e1297c

Please sign in to comment.