class CreateStores < ActiveRecord::Migration[8.1]
  def change
    create_table :stores, id: { type: :bigint, unsigned: true },
                          charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci",
                          if_not_exists: true do |t|
      # A store is a WarpEngine catalog plus the repository that configures a
      # client for it. The registry lives here rather than in the engine: the
      # engine serves one catalog and knows nothing about who ships stores for it.
      t.string   :name,                 null: false
      t.string   :catalog_url,          null: false
      t.string   :store_repository_url, null: false
      t.datetime :deleted_at, precision: 3
      t.timestamps            precision: 3

      t.index :deleted_at, name: "idx_stores_deleted_at"
      t.index :name,       name: "idx_stores_name"
    end
  end
end
