StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "adv_bgs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "adv_bg_type" varchar, "adv_bg_id" integer, "uploaded_file_file_name" varchar, "uploaded_file_content_type" varchar, "uploaded_file_file_size" integer, "uploaded_file_updated_at" datetime, "head" boolean DEFAULT 'f', "imageable_id" integer, "imageable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "adv_bgs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "adv_bg_type" varchar, "adv_bg_id" integer, "uploaded_file_file_name" varchar, "uploaded_file_content_type" varchar, "uploaded_file_file_size" integer, "uploaded_file_updated_at" datetime, "head" boolean DEFAULT 'f', "imageable_id" integer, "imageable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
SQLite3::SQLException: near "ENGINE": syntax error
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
What Do I do?
20170425144835_init_schema.rb
class InitSchema < ActiveRecord::Migration
def up
create_table "adv_bgs", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_bg_type"
t.integer "adv_bg_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_bg_type", "adv_bg_id"], name: "index_adv_bgs_on_adv_bg_type_and_adv_bg_id", using: :btree
t.index ["head"], name: "index_adv_bgs_on_head", using: :btree
end
create_table "adv_logos", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_logo_type"
t.integer "adv_logo_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_logo_type", "adv_logo_id"], name: "index_adv_logos_on_adv_logo_type_and_adv_logo_id", using: :btree
t.index ["head"], name: "index_adv_logos_on_head", using: :btree
end
create_table "adv_pic1s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic1_type"
t.integer "adv_pic1_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic1_type", "adv_pic1_id"], name: "index_adv_pic1s_on_adv_pic1_type_and_adv_pic1_id", using: :btree
t.index ["head"], name: "index_adv_pic1s_on_head", using: :btree
end
create_table "adv_pic2s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic2_type"
t.integer "adv_pic2_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic2_type", "adv_pic2_id"], name: "index_adv_pic2s_on_adv_pic2_type_and_adv_pic2_id", using: :btree
t.index ["head"], name: "index_adv_pic2s_on_head", using: :btree
end
create_table "adv_pic3s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic3_type"
t.integer "adv_pic3_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic3_type", "adv_pic3_id"], name: "index_adv_pic3s_on_adv_pic3_type_and_adv_pic3_id", using: :btree
t.index ["head"], name: "index_adv_pic3s_on_head", using: :btree
end
create_table "adv_pic4s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic4_type"
t.integer "adv_pic4_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic4_type", "adv_pic4_id"], name: "index_adv_pic4s_on_adv_pic4_type_and_adv_pic4_id", using: :btree
t.index ["head"], name: "index_adv_pic4s_on_head", using: :btree
end
create_table "adv_pic5s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic5_type"
t.integer "adv_pic5_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic5_type", "adv_pic5_id"], name: "index_adv_pic5s_on_adv_pic5_type_and_adv_pic5_id", using: :btree
t.index ["head"], name: "index_adv_pic5s_on_head", using: :btree
end
create_table "adv_pic6s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic6_type"
t.integer "adv_pic6_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic6_type", "adv_pic6_id"], name: "index_adv_pic6s_on_adv_pic6_type_and_adv_pic6_id", using: :btree
t.index ["head"], name: "index_adv_pic6s_on_head", using: :btree
end
create_table "adv_pic7s", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "adv_pic7_type"
t.integer "adv_pic7_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.boolean "head", default: false
t.integer "imageable_id"
t.string "imageable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["adv_pic7_type", "adv_pic7_id"], name: "index_adv_pic7s_on_adv_pic7_type_and_adv_pic7_id", using: :btree
t.index ["head"], name: "index_adv_pic7s_on_head", using: :btree
end
create_table "advertising_applications", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.integer "user_id"
t.integer "anon_user_id"
t.integer "televisor_id", limit: 1, null: false
t.integer "advertising_public_status_id", limit: 1, default: 1
t.integer "advertising_period_id", limit: 1, default: 1
t.integer "payment_status_id", limit: 1, default: 1
t.integer "step", limit: 1, default: 1
t.integer "spec_id", limit: 1, default: 1
t.string "email"
t.string "lnk"
t.string "redwords"
t.string "zkname"
t.string "zkdescr"
t.integer "price"
t.integer "charge", limit: 1, default: 1
t.datetime "endtime", default: '2017-04-25 17:47:04'
t.text "comment", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["advertising_period_id"], name: "index_advertising_applications_on_advertising_period_id", using: :btree
t.index ["advertising_public_status_id"], name: "index_advertising_applications_on_advertising_public_status_id", using: :btree
t.index ["anon_user_id"], name: "index_advertising_applications_on_anon_user_id", using: :btree
t.index ["payment_status_id"], name: "index_advertising_applications_on_payment_status_id", using: :btree
t.index ["televisor_id"], name: "index_advertising_applications_on_televisor_id", using: :btree
t.index ["user_id"], name: "index_advertising_applications_on_user_id", using: :btree
end
create_table "advertising_periods", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "advertising_public_statuses", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "anon_saved_searches", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "subtype", limit: 3, null: false
t.string "link_to", limit: 64, null: false
t.string "name", limit: 32
t.string "category"
t.string "square_from", limit: 24
t.string "square_to", limit: 24
t.string "price_from", limit: 24
t.string "price_to", limit: 24
t.string "price_src", limit: 3
t.text "data", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "metro_data", limit: 65535, null: false
t.integer "add_params_count", limit: 1, unsigned: true
t.integer "main_city", limit: 1, unsigned: true
t.text "location_tags_data", limit: 65535, null: false
end
create_table "anon_users", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "email"
t.string "access_level", limit: 16, default: "anon", null: false
t.string "access_code", limit: 32, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_anon_users_on_email", using: :btree
end
create_table "area_types", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "avatars", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "imageable_type"
t.integer "imageable_id"
t.string "uploaded_file_file_name"
t.string "uploaded_file_content_type"
t.integer "uploaded_file_file_size"
t.datetime "uploaded_file_updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["imageable_type", "imageable_id"], name: "index_avatars_on_imageable_type_and_imageable_id", using: :btree
end
create_table "bad_room_kinds", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "bad_room_nums", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "bad_room_presents", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "balcons", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "bg_cn_names", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["value"], name: "ivalue", type: :fulltext
end
You are using MySQL-specific syntax ENGINE=MyISAM DEFAULT CHARSET=utf8 in SQLite database: SQLite3::SQLException: near "ENGINE":
Related
I'm new to Ruby on Rails and I got two problems where I need some help:
I got the tables "cases" and "users". The table case includes the column "first name" and "last name". Now I want to add a unique string (pseudonymization) to each case for a special kind of identification without using the ID. This string should be build from the third letter of the first name and the total amount of letters plus the third letter of the last name and again the total amount of letters of the last name. E.g. for the name "Bill Smith" the string would be: L4I5.
Now the "users" should be able to find a specific case using that created special string. There should be a kind of a searching field where they can type in the string and click on search. Then the case with all the parameters should be shown.
What is the best way, to implement these two functions/features? I'm using rails 6.0.3.4 and ruby 2.7.0.
For better understanding see my schema.rb below.
ActiveRecord::Schema.define(version: 2021_01_28_100706) do
create_table "cases", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "gender"
t.date "birthdate"
t.string "place_of_residence"
t.string "diagnosis"
t.bigint "user_id"
t.datetime "confirmed_at"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6, null: false
t.bigint "diagnosis_id"
t.bigint "district_id"
t.bigint "report_id"
t.index ["diagnosis_id"], name: "index_cases_on_diagnosis_id"
t.index ["district_id"], name: "index_cases_on_district_id"
t.index ["report_id"], name: "index_cases_on_report_id"
t.index ["user_id"], name: "index_cases_on_user_id"
end
create_table "diagnoses", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "illness"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "districts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name"
t.string "place"
t.integer "postal_code"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.bigint "state_id", null: false
t.index ["state_id"], name: "index_districts_on_state_id"
end
create_table "reports", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "district_id"
t.text "comment"
t.datetime "date"
t.bigint "user_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["district_id"], name: "index_reports_on_district_id"
t.index ["user_id"], name: "index_reports_on_user_id"
end
create_table "states", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "titel"
t.string "abbr"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "role"
t.string "first_name"
t.string "last_name"
t.bigint "district_id"
t.bigint "state_id"
t.index ["district_id"], name: "index_users_on_district_id"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["state_id"], name: "index_users_on_state_id"
end
end
You could add a column to the case table and a callback in the model to set it how you want. And to search just add a scope
#migration
add_column :cases, :new_column, :string, index: true
#model
class Case < ApplicationRecord
before_create :set_new_column
scope :by_new_column, ->(term) { where('new_column = ?', term) }
...
private
def set_new_column
self.new_column = "#{first_name[0]}#{last_name.length}"
end
end
Then in your controller or where ever, you could use like:
Case.by_new_column("C5")
Users can upload tracks and create playlist. I have a model for playlist and i have a model for playlist_track which is for users that can save to the playlist. I can create a new playlist but how do i add the tracks to the playlist in the views?
ActiveRecord::Schema.define(version: 2018_12_06_050857) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.bigint "record_id", null: false
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "playlist_tracks", force: :cascade do |t|
t.integer "playlist_id"
t.integer "track_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "playlists", force: :cascade do |t|
t.string "title"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "plays", force: :cascade do |t|
t.integer "user_id"
t.integer "track_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "tracks", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "genre"
t.integer "user_id"
t.string "name"
t.date "release_date"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "username"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
end
Here is my track model
class Track < ApplicationRecord
has_many_attached :mp3
belongs_to :user, optional: true
has_many :playlist_tracks
has_many :playlists, through: :playlist_tracks
has_many :plays
end
and here is my playist_track model
class PlaylistTrack < ApplicationRecord
belongs_to :playlist
belongs_to :track
end
I am trying to deploy a big change I made to my code into heroku.
When I run heroku run rails db:migrate I get the following error:
I, [2018-05-01T18:07:40.587276 #4] INFO -- : Migrating to AddShopToListing (20180415173504)
D, [2018-05-01T18:07:40.592452 #4] DEBUG -- : (1.1ms) BEGIN
== 20180415173504 AddShopToListing: migrating =================================
-- add_reference(:listings, :shop, {:references=>:shops, :index=>true})
D, [2018-05-01T18:07:40.597146 #4] DEBUG -- : (2.7ms) ALTER TABLE "listings" ADD "shop_id" bigint
D, [2018-05-01T18:07:40.690959 #4] DEBUG -- : (87.4ms) CREATE INDEX "index_listings_on_shop_id" ON "listings" ("shop_id")
-> 0.0983s
-- add_foreign_key(:listings, :shop, {:column=>:shop_id})
D, [2018-05-01T18:07:40.699348 #4] DEBUG -- : (6.9ms) ALTER TABLE "listings" ADD CONSTRAINT "fk_rails_72ed4e1344"
FOREIGN KEY ("shop_id")
REFERENCES "shop" ("id")
D, [2018-05-01T18:07:40.704937 #4] DEBUG -- : (5.3ms) ROLLBACK
D, [2018-05-01T18:07:40.709352 #4] DEBUG -- : (4.1ms) SELECT pg_advisory_unlock(391033951906602690)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "shop" does not exist
: ALTER TABLE "listings" ADD CONSTRAINT "fk_rails_72ed4e1344"
FOREIGN KEY ("shop_id")
REFERENCES "shop" ("id")
Here is the offending migration file:
class AddShopToListing < ActiveRecord::Migration[5.1]
def change
add_reference :listings, :shop, references: :shops, index: true
add_foreign_key :listings, :shop, column: :shop_id
end
end
I cannot find what is causing this problem - the only thing I see is that in my heroku schema I have these lines:
add_foreign_key "sellers", "users"
add_foreign_key "shops", "listings"
add_foreign_key "shops", "sellers"
add_foreign_key "shops", "users"
When on my local schema I do not.
Here's the local schema:
ActiveRecord::Schema.define(version: 20180501104731) do
create_table "letsencrypt_plugin_challenges", force: :cascade do |t|
t.text "response"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "letsencrypt_plugin_settings", force: :cascade do |t|
t.text "private_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "listings", force: :cascade do |t|
t.integer "listing_id"
t.string "state"
t.integer "user_id"
t.integer "category_id"
t.string "title"
t.float "original_creation_tsz"
t.float "ending_tsz"
t.float "last_modified_tsz"
t.float "creation_tsz"
t.string "price"
t.string "currency_code"
t.integer "quantity"
t.string "tag_1"
t.string "tag_2"
t.string "tag_3"
t.string "tag_4"
t.string "tag_5"
t.string "tag_6"
t.string "tag_7"
t.string "tag_8"
t.string "tag_9"
t.string "tag_10"
t.string "tag_11"
t.string "tag_12"
t.string "tag_13"
t.integer "category_path_ids"
t.float "state_tsz"
t.string "url"
t.integer "views"
t.integer "num_favorers"
t.boolean "is_supply"
t.boolean "is_private"
t.string "recipient"
t.string "occasion"
t.boolean "is_digital"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "tags", default: "--- []\n"
t.string "img"
t.integer "shop_id"
t.index ["listing_id"], name: "index_listings_on_listing_id", unique: true
t.index ["shop_id"], name: "index_listings_on_shop_id"
t.index ["tag_1"], name: "index_listings_on_tag_1"
t.index ["tag_10"], name: "index_listings_on_tag_10"
t.index ["tag_11"], name: "index_listings_on_tag_11"
t.index ["tag_12"], name: "index_listings_on_tag_12"
t.index ["tag_13"], name: "index_listings_on_tag_13"
t.index ["tag_2"], name: "index_listings_on_tag_2"
t.index ["tag_3"], name: "index_listings_on_tag_3"
t.index ["tag_4"], name: "index_listings_on_tag_4"
t.index ["tag_5"], name: "index_listings_on_tag_5"
t.index ["tag_6"], name: "index_listings_on_tag_6"
t.index ["tag_7"], name: "index_listings_on_tag_7"
t.index ["tag_8"], name: "index_listings_on_tag_8"
t.index ["tag_9"], name: "index_listings_on_tag_9"
end
create_table "searches", force: :cascade do |t|
t.string "term"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "searches_listings", force: :cascade do |t|
t.integer "search_id"
t.integer "listing_id"
t.index ["listing_id"], name: "index_searches_listings_on_listing_id"
t.index ["search_id"], name: "index_searches_listings_on_search_id"
end
create_table "sellers", force: :cascade do |t|
t.string "name"
t.integer "seller_id"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_sellers_on_user_id"
end
create_table "shops", force: :cascade do |t|
t.integer "shop_id"
t.string "shop_name"
t.integer "user_id"
t.float "creation_tsz"
t.string "title"
t.string "announcement"
t.boolean "is_vacation"
t.float "last_updated_tsz"
t.integer "listing_active_count"
t.integer "digital_listing_count"
t.string "login_name"
t.string "url"
t.string "image_url_760x100"
t.integer "num_favorers"
t.string "icon_url_fullxfull"
t.boolean "is_using_structured_policies"
t.integer "listing_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "seller_id"
t.index ["listing_id"], name: "index_shops_on_listing_id"
t.index ["seller_id"], name: "index_shops_on_seller_id"
t.index ["user_id"], name: "index_shops_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "password_digest"
t.string "remember_digest"
t.boolean "admin", default: false
t.string "activation_digest"
t.boolean "activated", default: false
t.datetime "activated_at"
t.string "reset_digest"
t.datetime "reset_sent_at"
t.string "request_token"
t.string "request_secret"
t.string "oauth_verifier"
t.string "oauth_token"
t.string "login_name"
t.integer "user_id"
t.boolean "accept_terms"
t.boolean "accept_privacy"
t.index ["email"], name: "index_users_on_email", unique: true
end
end
Here is the heroku schema:
enable_extension "plpgsql"
create_table "letsencrypt_plugin_challenges", id: :serial, force: :cascade do |t|
t.text "response"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "letsencrypt_plugin_settings", id: :serial, force: :cascade do |t|
t.text "private_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "listings", force: :cascade do |t|
t.integer "listing_id"
t.string "state"
t.integer "user_id"
t.integer "category_id"
t.string "title"
t.float "original_creation_tsz"
t.float "ending_tsz"
t.float "last_modified_tsz"
t.float "creation_tsz"
t.string "price"
t.string "currency_code"
t.integer "quantity"
t.string "tag_1"
t.string "tag_2"
t.string "tag_3"
t.string "tag_4"
t.string "tag_5"
t.string "tag_6"
t.string "tag_7"
t.string "tag_8"
t.string "tag_9"
t.string "tag_10"
t.string "tag_11"
t.string "tag_12"
t.string "tag_13"
t.integer "category_path_ids"
t.float "state_tsz"
t.string "url"
t.integer "views"
t.integer "num_favorers"
t.boolean "is_supply"
t.boolean "is_private"
t.string "recipient"
t.string "occasion"
t.boolean "is_digital"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "tags", default: "--- []\n"
t.string "img"
t.index ["listing_id"], name: "index_listings_on_listing_id", unique: true
t.index ["tag_1"], name: "index_listings_on_tag_1"
t.index ["tag_10"], name: "index_listings_on_tag_10"
t.index ["tag_11"], name: "index_listings_on_tag_11"
t.index ["tag_12"], name: "index_listings_on_tag_12"
t.index ["tag_13"], name: "index_listings_on_tag_13"
t.index ["tag_2"], name: "index_listings_on_tag_2"
t.index ["tag_3"], name: "index_listings_on_tag_3"
t.index ["tag_4"], name: "index_listings_on_tag_4"
t.index ["tag_5"], name: "index_listings_on_tag_5"
t.index ["tag_6"], name: "index_listings_on_tag_6"
t.index ["tag_7"], name: "index_listings_on_tag_7"
t.index ["tag_8"], name: "index_listings_on_tag_8"
t.index ["tag_9"], name: "index_listings_on_tag_9"
end
create_table "sellers", force: :cascade do |t|
t.string "name"
t.integer "seller_id"
t.bigint "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_sellers_on_user_id"
end
create_table "shops", force: :cascade do |t|
t.integer "shop_id"
t.string "shop_name"
t.bigint "user_id"
t.float "creation_tsz"
t.string "title"
t.string "announcement"
t.boolean "is_vacation"
t.float "last_updated_tsz"
t.integer "listing_active_count"
t.integer "digital_listing_count"
t.string "login_name"
t.string "url"
t.string "image_url_760x100"
t.integer "num_favorers"
t.string "icon_url_fullxfull"
t.boolean "is_using_structured_policies"
t.bigint "listing_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "seller_id"
t.index ["listing_id"], name: "index_shops_on_listing_id"
t.index ["seller_id"], name: "index_shops_on_seller_id"
t.index ["user_id"], name: "index_shops_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "password_digest"
t.string "remember_digest"
t.boolean "admin", default: false
t.string "activation_digest"
t.boolean "activated", default: false
t.datetime "activated_at"
t.string "reset_digest"
t.datetime "reset_sent_at"
t.string "request_token"
t.string "request_secret"
t.string "oauth_verifier"
t.string "oauth_token"
t.string "login_name"
t.integer "user_id"
t.index ["email"], name: "index_users_on_email", unique: true
end
add_foreign_key "sellers", "users"
add_foreign_key "shops", "listings"
add_foreign_key "shops", "sellers"
add_foreign_key "shops", "users"
end
Could you please help me?
I tried everything, including rolling back in the app to the day before I created the Shop model, but apparently it doesn't roll the db.
I also tried cloning it locally to work on the code from there but it clones the most recent commit, not the one that is currently active in the app.
Thanks in advance!
The issue happens here:
-- add_foreign_key(:listings, :shop, {:column=>:shop_id})
ALTER TABLE "listings"
ADD CONSTRAINT "fk_rails_72ed4e1344"
FOREIGN KEY ("shop_id")
REFERENCES "shop" ("id") -- <<<< HERE, it should be `shops` instead of `shop`
The second argument of add_foreign_key is supposed to be the table's name, in your case:
add_foreign_key :listings, :shops, column: :shop_id
# ^ plural
Im attempting to rake my migrations on my heroku distro. im getting this error:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "plants" does not exist
: ALTER TABLE "images" ADD CONSTRAINT "fk_rails_d5e1aedcb5"
FOREIGN KEY ("plant_id")
REFERENCES "plants" ("id")
Some of my tables go through, but not this one, im not sure what is even going on here. It works in development, but not in production.
Here is my schema file:
ActiveRecord::Schema.define(version: 20160521081000) do
create_table "appointments", force: :cascade do |t|
t.string "task"
t.datetime "time"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "categories", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
end
create_table "cycles", force: :cascade do |t|
t.string "title"
t.datetime "completed_at"
t.boolean "completed"
t.integer "tray_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "due_date"
end
add_index "cycles", ["tray_id"], name: "index_cycles_on_tray_id"
create_table "datalogs", force: :cascade do |t|
t.integer "tray_id"
t.float "ambcur"
t.float "ambmin"
t.float "ambmax"
t.float "folcur"
t.float "folmin"
t.float "folmax"
t.float "ph"
t.float "heatmat"
t.float "h202"
t.float "tds"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "datalogs", ["tray_id"], name: "index_datalogs_on_tray_id"
create_table "events", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "grows", force: :cascade do |t|
t.string "title"
t.text "notes"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "category_id"
t.integer "user_id"
end
create_table "images", force: :cascade do |t|
t.string "file_id"
t.integer "plant_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "tray_id"
end
add_index "images", ["plant_id"], name: "index_images_on_plant_id"
create_table "nutrient_calcs", force: :cascade do |t|
t.string "product"
t.integer "vegtime"
t.integer "flowertime"
t.float "rezsize"
t.string "rezunits"
t.boolean "aerstone"
t.string "outputunits"
t.integer "nutrient_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "nutrient_calcs", ["nutrient_id"], name: "index_nutrient_calcs_on_nutrient_id"
create_table "nutrients", force: :cascade do |t|
t.string "title"
t.string "manufacturer"
t.float "price"
t.string "unit"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "pages", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "pics", force: :cascade do |t|
t.string "title"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "plant_cycles", force: :cascade do |t|
t.string "title"
t.integer "interval"
t.integer "frequency"
t.integer "plant_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "plant_cycles", ["plant_id"], name: "index_plant_cycles_on_plant_id"
create_table "plantdats", force: :cascade do |t|
t.float "ambtemp"
t.float "foltempcur"
t.float "foltempmin"
t.float "foltempmax"
t.float "ph"
t.float "heatmat"
t.integer "tds"
t.float "h202"
t.integer "plant_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.float "ambtempmin"
t.float "ambtembmax"
end
add_index "plantdats", ["plant_id"], name: "index_plantdats_on_plant_id"
create_table "plants", force: :cascade do |t|
t.string "title"
t.text "notes"
t.integer "category_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "species"
t.integer "tray_id"
t.integer "species_id"
t.integer "user_id"
end
add_index "plants", ["category_id"], name: "index_plants_on_category_id"
add_index "plants", ["tray_id"], name: "index_plants_on_tray_id"
add_index "plants", ["user_id"], name: "index_plants_on_user_id"
create_table "schedules", force: :cascade do |t|
t.integer "schedulable_id"
t.string "schedulable_type"
t.date "date"
t.time "time"
t.string "rule"
t.string "interval"
t.text "day"
t.text "day_of_week"
t.datetime "until"
t.integer "count"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "species", force: :cascade do |t|
t.string "name"
t.text "description"
t.integer "plant_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "species", ["plant_id"], name: "index_species_on_plant_id"
create_table "tasks", force: :cascade do |t|
t.integer "plant_id"
t.integer "tray_id"
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "due_date"
end
add_index "tasks", ["plant_id"], name: "index_tasks_on_plant_id"
add_index "tasks", ["tray_id"], name: "index_tasks_on_tray_id"
create_table "tray_cycles", force: :cascade do |t|
t.string "title"
t.integer "tray_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "tray_cycles", ["tray_id"], name: "index_tray_cycles_on_tray_id"
create_table "trays", force: :cascade do |t|
t.string "title"
t.text "notes"
t.integer "category_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.integer "rescap"
end
add_index "trays", ["category_id"], name: "index_trays_on_category_id"
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.string "firstname"
t.string "lastname"
t.string "username"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
Also, my app gets pushed to Heroku, but when I go to 'sign_up', I get the error from the heroku logs:
2016-05-22T07:53:31.678059+00:00 app[web.1]: ActionView::Template::Error (undefined method `firstname' for #<User:0x007fa667e33798>):
2016-05-22T07:53:31.678049+00:00 app[web.1]:
2016-05-22T07:53:31.678060+00:00 app[web.1]: 25:
2016-05-22T07:53:31.678061+00:00 app[web.1]: 26: <div class="field">
2016-05-22T07:53:31.678062+00:00 app[web.1]: 27: <%= f.label 'First Name' %><br />
2016-05-22T07:53:31.678063+00:00 app[web.1]: 28: <%= f.text_field :firstname, autofocus: true, rows: 10, cols: 10, class: 'form-control', placeholder: 'ENTER FIRST NAME' %>
2016-05-22T07:53:31.678064+00:00 app[web.1]: 29: </div>
2016-05-22T07:53:31.678065+00:00 app[web.1]: 30:
2016-05-22T07:53:31.678065+00:00 app[web.1]: 31: <div class="field">
Can anyone help me figure this out? Many thanks :)
Apparently one of the migration files got lost.
If the migration directory is quite full, or not consistent with the database you can use rake db:schema:load to directly create the whole DB.
Thanks to #xyious in the comments. Somehow a few migrations got deleted unbeknownst to me. Running heroku run rake db:schema:load
fixed the problem.
I have been running a few migrations and it doesnt update the schema file. I know the migrations have correctly changed my database but it seems my schema file wont change anymore... Here's my schema file. It misses the last table I have created (table 'notifications') and the several migrations I runned on this table.
ActiveRecord::Schema.define(version: 20150501141614) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace"
t.text "body"
t.string "resource_id", null: false
t.string "resource_type", null: false
t.integer "author_id"
t.string "author_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree
create_table "activities", force: :cascade do |t|
t.integer "trackable_id"
t.string "trackable_type"
t.integer "owner_id"
t.string "owner_type"
t.string "key"
t.text "parameters"
t.integer "recipient_id"
t.string "recipient_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "activities", ["owner_id", "owner_type"], name: "index_activities_on_owner_id_and_owner_type", using: :btree
add_index "activities", ["recipient_id", "recipient_type"], name: "index_activities_on_recipient_id_and_recipient_type", using: :btree
add_index "activities", ["trackable_id", "trackable_type"], name: "index_activities_on_trackable_id_and_trackable_type", using: :btree
create_table "clients", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "convocations", force: :cascade do |t|
t.date "date"
t.time "hour"
t.integer "subscription_id"
t.string "status", default: "pending"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "convocations", ["subscription_id"], name: "index_convocations_on_subscription_id", using: :btree
create_table "mailboxer_conversation_opt_outs", force: :cascade do |t|
t.integer "unsubscriber_id"
t.string "unsubscriber_type"
t.integer "conversation_id"
end
add_index "mailboxer_conversation_opt_outs", ["conversation_id"], name: "index_mailboxer_conversation_opt_outs_on_conversation_id", using: :btree
add_index "mailboxer_conversation_opt_outs", ["unsubscriber_id", "unsubscriber_type"], name: "index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type", using: :btree
create_table "mailboxer_conversations", force: :cascade do |t|
t.string "subject", default: ""
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "mailboxer_notifications", force: :cascade do |t|
t.string "type"
t.text "body"
t.string "subject", default: ""
t.integer "sender_id"
t.string "sender_type"
t.integer "conversation_id"
t.boolean "draft", default: false
t.string "notification_code"
t.integer "notified_object_id"
t.string "notified_object_type"
t.string "attachment"
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.boolean "global", default: false
t.datetime "expires"
end
add_index "mailboxer_notifications", ["conversation_id"], name: "index_mailboxer_notifications_on_conversation_id", using: :btree
add_index "mailboxer_notifications", ["notified_object_id", "notified_object_type"], name: "index_mailboxer_notifications_on_notified_object_id_and_type", using: :btree
add_index "mailboxer_notifications", ["sender_id", "sender_type"], name: "index_mailboxer_notifications_on_sender_id_and_sender_type", using: :btree
add_index "mailboxer_notifications", ["type"], name: "index_mailboxer_notifications_on_type", using: :btree
create_table "mailboxer_receipts", force: :cascade do |t|
t.integer "receiver_id"
t.string "receiver_type"
t.integer "notification_id", null: false
t.boolean "is_read", default: false
t.boolean "trashed", default: false
t.boolean "deleted", default: false
t.string "mailbox_type", limit: 25
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "mailboxer_receipts", ["notification_id"], name: "index_mailboxer_receipts_on_notification_id", using: :btree
add_index "mailboxer_receipts", ["receiver_id", "receiver_type"], name: "index_mailboxer_receipts_on_receiver_id_and_receiver_type", using: :btree
create_table "messages", force: :cascade do |t|
t.integer "user_id"
t.datetime "read_at"
t.text "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "convocation_id"
end
add_index "messages", ["user_id"], name: "index_messages_on_user_id", using: :btree
create_table "subscriptions", force: :cascade do |t|
t.integer "user_id"
t.integer "tournament_id"
t.string "status", default: "pending"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "subscriptions", ["tournament_id"], name: "index_subscriptions_on_tournament_id", using: :btree
add_index "subscriptions", ["user_id"], name: "index_subscriptions_on_user_id", using: :btree
create_table "tournaments", force: :cascade do |t|
t.integer "user_id"
t.string "genre"
t.string "category"
t.boolean "accepted"
t.integer "amount"
t.date "starts_on"
t.date "ends_on"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "address"
t.string "city"
t.string "name"
t.string "club_organisateur"
t.float "latitude"
t.float "longitude"
end
add_index "tournaments", ["user_id"], name: "index_tournaments_on_user_id", using: :btree
create_table "transfers", force: :cascade do |t|
t.string "status"
t.integer "mangopay_transaction_id"
t.string "category"
t.json "archive"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "tournament_id"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: ""
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "first_name"
t.string "last_name"
t.string "ranking"
t.boolean "judge", default: false
t.string "genre"
t.string "date_of_birth"
t.string "licence_number"
t.integer "judge_number"
t.string "invitation_token"
t.datetime "invitation_created_at"
t.datetime "invitation_sent_at"
t.datetime "invitation_accepted_at"
t.integer "invitation_limit"
t.integer "invited_by_id"
t.string "invited_by_type"
t.integer "invitations_count", default: 0
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "name"
t.string "telephone"
t.string "picture_file_name"
t.string "picture_content_type"
t.integer "picture_file_size"
t.datetime "picture_updated_at"
t.string "provider"
t.string "uid"
t.string "picture"
t.string "token"
t.datetime "token_expiry"
t.boolean "admin", default: false, null: false
t.string "licencepicture_file_name"
t.string "licencepicture_content_type"
t.integer "licencepicture_file_size"
t.datetime "licencepicture_updated_at"
t.string "certifmedpicture_file_name"
t.string "certifmedpicture_content_type"
t.integer "certifmedpicture_file_size"
t.datetime "certifmedpicture_updated_at"
t.string "attestationformationja_file_name"
t.string "attestationformationja_content_type"
t.integer "attestationformationja_file_size"
t.datetime "attestationformationja_updated_at"
t.integer "client_id"
t.integer "mangopay_natural_user_id"
t.integer "wallet_id"
t.integer "kyc_document_id"
t.integer "card_id"
t.datetime "birthdate"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true, using: :btree
add_index "users", ["invitations_count"], name: "index_users_on_invitations_count", using: :btree
add_index "users", ["invited_by_id"], name: "index_users_on_invited_by_id", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_foreign_key "convocations", "subscriptions"
add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations", column: "conversation_id", name: "mb_opt_outs_on_conversations_id"
add_foreign_key "mailboxer_notifications", "mailboxer_conversations", column: "conversation_id", name: "notifications_on_conversation_id"
add_foreign_key "mailboxer_receipts", "mailboxer_notifications", column: "notification_id", name: "receipts_on_notification_id"
add_foreign_key "subscriptions", "tournaments"
add_foreign_key "subscriptions", "users"
add_foreign_key "tournaments", "users"
end
I then ran rake db:drop db:create db:migrate but my schema file was still incomplete. I then tried to run another migration just to check:
class AddColumnClubToUsers < ActiveRecord::Migration
def change
add_column :users, :club, :string
end
end
but the schema file still wouldnt update
Just rebuild DB in development use: rake db:drop db:create db:migrate. This command should drop DB and rebuild it from scratch include schema.rb.
If this is doesn't work then change your new migrations. Probably you have mistake (i.e. typo in method name, etc.).