Created
May 5, 2016 16:33
-
-
Save jrafanie/553e35f560c18ab0c80857b96f7bbde3 to your computer and use it in GitHub Desktop.
Rails 5.0.0.beta4 creates references, polymorphic => true id/type columns in reverse order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails', '~>4.2.0' | |
| # gem 'rails', github: 'rails/rails' | |
| gem 'sqlite3' | |
| end | |
| require 'active_record' | |
| require 'minitest/autorun' | |
| require 'logger' | |
| # This connection will do for database-independent bug reports. | |
| ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
| logger = Logger.new(STDOUT) | |
| logger.level = 1 | |
| ActiveRecord::Base.logger = logger | |
| ActiveRecord::Schema.define do | |
| create_table :posts, force: true do |t| | |
| end | |
| create_table :comments, force: true do |t| | |
| t.references :resource, :polymorphic => true | |
| end | |
| end | |
| class Post < ActiveRecord::Base | |
| has_many :comments | |
| end | |
| class Comment < ActiveRecord::Base | |
| belongs_to :post | |
| end | |
| puts "Rails version: " + Rails.version | |
| ActiveRecord::SchemaDumper.dump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails version: 4.1.15 | |
| # 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. | |
| # | |
| # Note that this schema.rb definition is the authoritative source for your | |
| # database schema. If you need to create the application database on another | |
| # system, you should be using db:schema:load, not running all the migrations | |
| # from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
| # you'll amass, the slower it'll run and the greater likelihood for issues). | |
| # | |
| # It's strongly recommended that you check this file into your version control system. | |
| ActiveRecord::Schema.define(version: 0) do | |
| create_table "comments", force: true do |t| | |
| t.integer "resource_id" | |
| t.string "resource_type" | |
| end | |
| create_table "posts", force: true do |t| | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails version: 4.2.6 | |
| # 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. | |
| # | |
| # Note that this schema.rb definition is the authoritative source for your | |
| # database schema. If you need to create the application database on another | |
| # system, you should be using db:schema:load, not running all the migrations | |
| # from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
| # you'll amass, the slower it'll run and the greater likelihood for issues). | |
| # | |
| # It's strongly recommended that you check this file into your version control system. | |
| ActiveRecord::Schema.define(version: 0) do | |
| create_table "comments", force: :cascade do |t| | |
| t.integer "resource_id" | |
| t.string "resource_type" | |
| end | |
| create_table "posts", force: :cascade do |t| | |
| end | |
| end | |
| Run options: --seed 19035 | |
| # Running: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails version: 5.0.0.beta4 | |
| # 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. | |
| # | |
| # Note that this schema.rb definition is the authoritative source for your | |
| # database schema. If you need to create the application database on another | |
| # system, you should be using db:schema:load, not running all the migrations | |
| # from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
| # you'll amass, the slower it'll run and the greater likelihood for issues). | |
| # | |
| # It's strongly recommended that you check this file into your version control system. | |
| ActiveRecord::Schema.define(version: 0) do | |
| create_table "comments", force: :cascade do |t| | |
| t.string "resource_type" | |
| t.integer "resource_id" | |
| t.index ["resource_type", "resource_id"], name: "index_comments_on_resource_type_and_resource_id" | |
| end | |
| create_table "posts", force: :cascade do |t| | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment