20230125210436_add_user_location_reject_table.php 692 B

12345678910111213141516
  1. <?php
  2. use Phinx\Migration\AbstractMigration;
  3. class AddUserLocationRejectTable extends AbstractMigration {
  4. public function change() {
  5. $this->table("user_location_reject", ["id" => false, "primary_key" => ["user_id", "location_id"]])
  6. ->addColumn("user_id", "integer", ["signed" => false])
  7. ->addColumn("location_id", "integer", ["signed" => false])
  8. ->addColumn("reject_count", "integer", ["signed" => false, "default" => 0])
  9. ->addColumn("dts_last_rejected", "datetime")
  10. ->addForeignKey("user_id", "user", "id", ["update" => "CASCADE", "delete" => "CASCADE"])
  11. ->addForeignKey("location_id", "user", "id", ["update" => "CASCADE", "delete" => "CASCADE"])
  12. ->create();
  13. }
  14. }