{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23508","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/23508/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23508/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23508/events","html_url":"https://github.com/rails/rails/pull/23508","id":131787423,"number":23508,"title":"Added numeric helper into `SchemaStatements` for MySQL and PostgreSQL","user":{"login":"meinac","id":1840945,"avatar_url":"https://avatars.githubusercontent.com/u/1840945?v=3","gravatar_id":"","url":"https://api.github.com/users/meinac","html_url":"https://github.com/meinac","followers_url":"https://api.github.com/users/meinac/followers","following_url":"https://api.github.com/users/meinac/following{/other_user}","gists_url":"https://api.github.com/users/meinac/gists{/gist_id}","starred_url":"https://api.github.com/users/meinac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meinac/subscriptions","organizations_url":"https://api.github.com/users/meinac/orgs","repos_url":"https://api.github.com/users/meinac/repos","events_url":"https://api.github.com/users/meinac/events{/privacy}","received_events_url":"https://api.github.com/users/meinac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-02-05T23:23:24Z","updated_at":"2016-02-05T23:26:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/23508","html_url":"https://github.com/rails/rails/pull/23508","diff_url":"https://github.com/rails/rails/pull/23508.diff","patch_url":"https://github.com/rails/rails/pull/23508.patch"},"body":"With this addition, you can add a column into the table like:\r\n\r\n```\r\n  create_table(:numeric_types) do |t|\r\n    t.numeric :foo, precision: 10, scale: 2, default: 2.0\r\n  end\r\n```\r\n\r\nThis migration creates a `numeric` column for PostgreSQL and `decimal` column for MySQL. The result of the migration above is same with:\r\n\r\n```\r\n  create_table(:numeric_types) do |t|\r\n    t.decimal :foo, precision: 10, scale: 2, default: 2.0\r\n  end\r\n```\r\n\r\nIn PostgreSQL decimal and numeric types are same. Decimal is alias for numeric. For more information about numeric types in PostgreSQL see http://www.postgresql.org/docs/current/interactive/datatype-numeric.html\r\nIn MySQL decimal and numeric types are same. Numeric is alias for decimal. For more information about fixed point types in MySQL see http://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/180619601","html_url":"https://github.com/rails/rails/pull/23508#issuecomment-180619601","issue_url":"https://api.github.com/repos/rails/rails/issues/23508","id":180619601,"user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T23:26:18Z","updated_at":"2016-02-05T23:26:18Z","body":"Wow, this is quite thorough! `numeric` is actually a relatively primitive type supported by all backends. I think we can just do `alias_method :numeric, :decimal` on the abstract adapter. I don't think this needs explicit tests or the additional error handling."}}