SQLiteBuilder.php 789B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Illuminate\Database\Schema;
  3. class SQLiteBuilder extends Builder
  4. {
  5. /**
  6. * Drop all tables from the database.
  7. *
  8. * @return void
  9. */
  10. public function dropAllTables()
  11. {
  12. if ($this->connection->getDatabaseName() !== ':memory:') {
  13. return $this->refreshDatabaseFile();
  14. }
  15. $this->connection->select($this->grammar->compileEnableWriteableSchema());
  16. $this->connection->select($this->grammar->compileDropAllTables());
  17. $this->connection->select($this->grammar->compileDisableWriteableSchema());
  18. }
  19. /**
  20. * Empty the database file.
  21. *
  22. * @return void
  23. */
  24. public function refreshDatabaseFile()
  25. {
  26. file_put_contents($this->connection->getDatabaseName(), '');
  27. }
  28. }