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.

Version14000Date20180626223656.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Core\Migrations;
  7. use OCP\DB\ISchemaWrapper;
  8. use OCP\Migration\SimpleMigrationStep;
  9. class Version14000Date20180626223656 extends SimpleMigrationStep {
  10. public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) {
  11. /** @var ISchemaWrapper $schema */
  12. $schema = $schemaClosure();
  13. if (!$schema->hasTable('whats_new')) {
  14. $table = $schema->createTable('whats_new');
  15. $table->addColumn('id', 'integer', [
  16. 'autoincrement' => true,
  17. 'notnull' => true,
  18. 'length' => 4,
  19. 'unsigned' => true,
  20. ]);
  21. $table->addColumn('version', 'string', [
  22. 'notnull' => true,
  23. 'length' => 64,
  24. 'default' => '11',
  25. ]);
  26. $table->addColumn('etag', 'string', [
  27. 'notnull' => true,
  28. 'length' => 64,
  29. 'default' => '',
  30. ]);
  31. $table->addColumn('last_check', 'integer', [
  32. 'notnull' => true,
  33. 'length' => 4,
  34. 'unsigned' => true,
  35. 'default' => 0,
  36. ]);
  37. $table->addColumn('data', 'text', [
  38. 'notnull' => true,
  39. 'default' => '',
  40. ]);
  41. $table->setPrimaryKey(['id']);
  42. $table->addUniqueIndex(['version'], 'version');
  43. $table->addIndex(['version', 'etag'], 'version_etag_idx');
  44. }
  45. return $schema;
  46. }
  47. }