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.

46 lines
1.0KB

  1. <?php
  2. namespace Framework\Database\Connection;
  3. use Framework\Database\Migration\Migration;
  4. use Framework\Database\QueryBuilder\QueryBuilder;
  5. use Pdo;
  6. abstract class Connection
  7. {
  8. /**
  9. * Get the underlying Pdo instance for this connection
  10. */
  11. abstract public function pdo(): Pdo;
  12. /**
  13. * Start a new query on this connection
  14. */
  15. abstract public function query(): QueryBuilder;
  16. /**
  17. * Start a new migration to add a table on this connection
  18. */
  19. abstract public function createTable(string $table): Migration;
  20. /**
  21. * Start a new migration to add a table on this connection
  22. */
  23. abstract public function alterTable(string $table): Migration;
  24. /**
  25. * Return a list of table names on this connection
  26. */
  27. abstract public function getTables(): array;
  28. /**
  29. * Find out if a table exists on this connection
  30. */
  31. abstract public function hasTable(string $name): bool;
  32. /**
  33. * Drop all tables in the current database
  34. */
  35. abstract public function dropTables(): int;
  36. }

Powered by TurnKey Linux.