{"action":"created","issue":{"url":"https://api.github.com/repos/jashmenn/activeuuid/issues/55","labels_url":"https://api.github.com/repos/jashmenn/activeuuid/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/jashmenn/activeuuid/issues/55/comments","events_url":"https://api.github.com/repos/jashmenn/activeuuid/issues/55/events","html_url":"https://github.com/jashmenn/activeuuid/issues/55","id":54121139,"number":55,"title":"t.uuid primary key migration creates sqlite_autoindex and schema:load fails","user":{"login":"luopio","id":69383,"avatar_url":"https://avatars.githubusercontent.com/u/69383?v=3","gravatar_id":"","url":"https://api.github.com/users/luopio","html_url":"https://github.com/luopio","followers_url":"https://api.github.com/users/luopio/followers","following_url":"https://api.github.com/users/luopio/following{/other_user}","gists_url":"https://api.github.com/users/luopio/gists{/gist_id}","starred_url":"https://api.github.com/users/luopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luopio/subscriptions","organizations_url":"https://api.github.com/users/luopio/orgs","repos_url":"https://api.github.com/users/luopio/repos","events_url":"https://api.github.com/users/luopio/events{/privacy}","received_events_url":"https://api.github.com/users/luopio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-12T23:12:20Z","updated_at":"2015-01-14T12:01:44Z","closed_at":"2015-01-14T12:01:44Z","body":"I'm integrating Ahoy with Rails 4.2.0.beta2 and thus using the git version of activeuuid. Given this migration:\r\n```\r\nclass CreateAhoyEvents < ActiveRecord::Migration\r\n  def change\r\n    create_table :ahoy_events, id: false do |t|\r\n      t.uuid :id, primary_key: true\r\n      t.uuid :visit_id\r\n      t.integer :user_id\r\n      t.string :name\r\n      t.text :properties\r\n      t.timestamp :time\r\n    end\r\n\r\n    add_index :ahoy_events, [:visit_id]\r\n    add_index :ahoy_events, [:user_id]\r\n    add_index :ahoy_events, [:time]\r\n  end\r\nend\r\n```\r\nCreates a schema like this: \r\n```\r\n  create_table \"ahoy_events\", force: true do |t|\r\n    t.uuid     \"visit_id\",   limit: 16\r\n    t.integer  \"user_id\"\r\n    t.string   \"name\"\r\n    t.text     \"properties\"\r\n    t.datetime \"time\"\r\n  end\r\n\r\n  add_index \"ahoy_events\", [\"id\"], name: \"sqlite_autoindex_ahoy_events_1\", unique: true\r\n  add_index \"ahoy_events\", [\"time\"], name: \"index_ahoy_events_on_time\"\r\n  add_index \"ahoy_events\", [\"user_id\"], name: \"index_ahoy_events_on_user_id\"\r\n  add_index \"ahoy_events\", [\"visit_id\"], name: \"index_ahoy_events_on_visit_id\"\r\n```\r\nWhich causes an error like this on schema loading (e.g. when running tests):\r\n```\r\ngems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:in `initialize': SQLite3::SQLException: object name reserved for internal use: sqlite_autoindex_ahoy_events_1: CREATE UNIQUE INDEX \"sqlite_autoindex_ahoy_events_1\" ON \"ahoy_events\" (\"id\") (ActiveRecord::StatementInvalid)\r\n```\r\nI've been unsuccessful in figuring out where that sqlite_autoindex line comes from, but changing `t.uuid` to `t.binary` seems to prevent it from happening. Is this a valid fix for sqlite? On the other hand, I'd very much like a migration that works both on our PostgreSQL servers and local development SQLites.\r\n"},"comment":{"url":"https://api.github.com/repos/jashmenn/activeuuid/issues/comments/69906714","html_url":"https://github.com/jashmenn/activeuuid/issues/55#issuecomment-69906714","issue_url":"https://api.github.com/repos/jashmenn/activeuuid/issues/55","id":69906714,"user":{"login":"luopio","id":69383,"avatar_url":"https://avatars.githubusercontent.com/u/69383?v=3","gravatar_id":"","url":"https://api.github.com/users/luopio","html_url":"https://github.com/luopio","followers_url":"https://api.github.com/users/luopio/followers","following_url":"https://api.github.com/users/luopio/following{/other_user}","gists_url":"https://api.github.com/users/luopio/gists{/gist_id}","starred_url":"https://api.github.com/users/luopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luopio/subscriptions","organizations_url":"https://api.github.com/users/luopio/orgs","repos_url":"https://api.github.com/users/luopio/repos","events_url":"https://api.github.com/users/luopio/events{/privacy}","received_events_url":"https://api.github.com/users/luopio/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T12:01:44Z","updated_at":"2015-01-14T12:01:44Z","body":"... and adding `self.primary_key = :id` in the models."}}