20190904222339_create_markers.rb 464 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. class CreateMarkers < ActiveRecord::Migration[5.2]
  3. def change
  4. create_table :markers do |t|
  5. t.references :user, foreign_key: { on_delete: :cascade, index: false }
  6. t.string :timeline, default: '', null: false
  7. t.bigint :last_read_id, default: 0, null: false
  8. t.integer :lock_version, default: 0, null: false
  9. t.timestamps
  10. end
  11. add_index :markers, [:user_id, :timeline], unique: true
  12. end
  13. end