spec/schema.rb in tokens-1.1.0 vs spec/schema.rb in tokens-2.0.0
- old
+ new
@@ -6,15 +6,20 @@
create_table :posts do |t|
t.string :title
end
create_table :tokens do |t|
- t.integer :tokenizable_id, :null => false
- t.string :tokenizable_type, :name, :null => false
- t.string :token, :null => false, :limit => 40
- t.text :data, :null => true
- t.datetime :expires_at, :null => true
- t.datetime :created_at
+ t.string :name, null: false
+ t.belongs_to :tokenizable, null: false, polymorphic: true
+ t.string :token, null: false
+ t.text :data, null: true
+ t.datetime :expires_at, null: true
+ t.datetime :created_at, null: false
end
- add_index :tokens, :token, :unique => true
+ add_index :tokens, :tokenizable_type
+ add_index :tokens, :tokenizable_id
+ add_index :tokens, [:tokenizable_type, :tokenizable_id]
+ add_index :tokens, :token
+ add_index :tokens, :expires_at
+ add_index :tokens, [:tokenizable_id, :tokenizable_type, :name], unique: true
end