class CreateChargeNotification < ActiveRecord::Migration[6.1]
  def change
    create_table :ChargeNotification, id: false do |t|
      t.string    :CNID, limit: 36, null: false, collation: "utf8mb4_unicode_ci"
      t.bigint    :SchoolID, null: false, unsigned: true
      t.bigint    :FamilyID, null: false, unsigned: true
      t.bigint    :BillingID, unsigned: true
      t.bigint    :StudentID, null: false, unsigned: true
      t.bigint    :AcctID, null: false, unsigned: true
      t.decimal   :Amount, precision: 10, scale: 2
      t.date      :DueDate
      t.timestamp :SentAt, default: nil
      t.timestamp :PaidAt, default: nil
      t.timestamp :CreatedAt, default: nil
    end

    add_index :ChargeNotification, :CNID, unique: true, name: "cnid_index", using: :btree
    add_index :ChargeNotification, :SchoolID, name: "charge_schoolid_index", using: :btree
  end
end
