# Migration
class CreateAccounts < ActiveRecord::Migration[7.1]
  def change
    create_table :accounts do |t|
      t.string :name
      t.string :subdomain

      t.timestamps
    end

    add_index :accounts, :subdomain, unique: true
    add_index :accounts, :created_at
  end
end
```
```ruby [app/models/account.rb]{3}