1
0

SQLiteMigrator.php 800 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\DB;
  8. use Doctrine\DBAL\Schema\Schema;
  9. class SQLiteMigrator extends Migrator {
  10. /**
  11. * @param Schema $targetSchema
  12. * @param \Doctrine\DBAL\Connection $connection
  13. * @return \Doctrine\DBAL\Schema\SchemaDiff
  14. */
  15. protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
  16. foreach ($targetSchema->getTables() as $table) {
  17. foreach ($table->getColumns() as $column) {
  18. // column comments are not supported on SQLite
  19. if ($column->getComment() !== null) {
  20. $column->setComment(null);
  21. }
  22. }
  23. }
  24. return parent::getDiff($targetSchema, $connection);
  25. }
  26. }