20240812165025_add_customer_entity_table.php 971 B

1234567891011121314151617181920212223
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. final class AddCustomerEntityTable extends AbstractMigration {
  5. public function change(): void {
  6. $this->table("customer_entity", ["signed" => false])
  7. ->addColumn("customer_id", "integer", ["signed" => false])
  8. ->addColumn("address_id", "integer", ["signed" => false])
  9. ->addColumn("name", "string")
  10. ->addColumn("phone", "string", ["null" => true])
  11. ->addColumn("fax", "string", ["null" => true])
  12. ->addColumn("email", "string", ["null" => true])
  13. ->addColumn("vat_number", "string", ["null" => true])
  14. ->addColumn("dts_created", "datetime")
  15. ->addColumn("dts_updated", "datetime", ["null" => true])
  16. ->addColumn("dts_deleted", "datetime", ["null" => true])
  17. ->addForeignKey("customer_id", "customer", "id", ["update" => "CASCADE", "delete" => "CASCADE"])
  18. ->addForeignKey("address_id", "address", "id", ["update" => "CASCADE", "delete" => "CASCADE"])
  19. ->create();
  20. }
  21. }