You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
823B

  1. <?php
  2. declare(strict_types=1);
  3. use Core\Database;
  4. use Core\Migration;
  5. return new class extends Migration
  6. {
  7. public function up(Database $database): void
  8. {
  9. $database->execute(
  10. 'CREATE TABLE IF NOT EXISTS employees (
  11. id INTEGER PRIMARY KEY AUTOINCREMENT,
  12. first_name VARCHAR(100) NOT NULL,
  13. last_name VARCHAR(100) NOT NULL,
  14. email VARCHAR(255) NOT NULL UNIQUE,
  15. department VARCHAR(100) NOT NULL,
  16. job_title VARCHAR(150) NOT NULL,
  17. start_date DATE NOT NULL,
  18. created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
  19. )'
  20. );
  21. }
  22. public function down(Database $database): void
  23. {
  24. $database->execute('DROP TABLE IF EXISTS employees');
  25. }
  26. };

Powered by TurnKey Linux.