{"action":"created","issue":{"url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/548","repository_url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter","labels_url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/548/labels{/name}","comments_url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/548/comments","events_url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/548/events","html_url":"https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/548","id":201449528,"number":548,"title":"Rails DDL (Migration DSL) for a unique ID","user":{"login":"j-mcnally","id":892382,"avatar_url":"https://avatars.githubusercontent.com/u/892382?v=3","gravatar_id":"","url":"https://api.github.com/users/j-mcnally","html_url":"https://github.com/j-mcnally","followers_url":"https://api.github.com/users/j-mcnally/followers","following_url":"https://api.github.com/users/j-mcnally/following{/other_user}","gists_url":"https://api.github.com/users/j-mcnally/gists{/gist_id}","starred_url":"https://api.github.com/users/j-mcnally/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-mcnally/subscriptions","organizations_url":"https://api.github.com/users/j-mcnally/orgs","repos_url":"https://api.github.com/users/j-mcnally/repos","events_url":"https://api.github.com/users/j-mcnally/events{/privacy}","received_events_url":"https://api.github.com/users/j-mcnally/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-18T00:54:00Z","updated_at":"2017-01-24T03:38:03Z","closed_at":null,"body":"So i am trying to create a UUID with the DB auto-creating the field.\r\n\r\nI cannot figure out how to do this with the rails migration syntax and ended up creating the following migration:\r\n\r\n```\r\nclass AddGuidToInvoices < ActiveRecord::Migration\r\n  def up\r\n    execute \"ALTER TABLE [invoices] ADD [guid] uniqueidentifier DEFAULT NEWID() NOT NULL\"\r\n  end\r\n\r\n  def down\r\n    execute \"ALTER TABLE [invoices] REMOVE [guid] uniqueidentifier DEFAULT NEWID() NOT NULL\"\r\n  end\r\n\r\nend\r\n```\r\n\r\nIs there a simpler way to achieve this?\r\n\r\nI tried a few things but could not get NEWID() as the default. Only the string \"NEWID()\". I tried a proc and a few other things.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/comments/274692777","html_url":"https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/548#issuecomment-274692777","issue_url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/548","id":274692777,"user":{"login":"metaskills","id":2381,"avatar_url":"https://avatars.githubusercontent.com/u/2381?v=3","gravatar_id":"","url":"https://api.github.com/users/metaskills","html_url":"https://github.com/metaskills","followers_url":"https://api.github.com/users/metaskills/followers","following_url":"https://api.github.com/users/metaskills/following{/other_user}","gists_url":"https://api.github.com/users/metaskills/gists{/gist_id}","starred_url":"https://api.github.com/users/metaskills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metaskills/subscriptions","organizations_url":"https://api.github.com/users/metaskills/orgs","repos_url":"https://api.github.com/users/metaskills/repos","events_url":"https://api.github.com/users/metaskills/events{/privacy}","received_events_url":"https://api.github.com/users/metaskills/received_events","type":"User","site_admin":false},"created_at":"2017-01-24T03:38:02Z","updated_at":"2017-01-24T03:38:02Z","body":"@j-mcnally Did you ever figure out why the test and your usage were different?"}}
{"actor":{"display_login":"metaskills"}}