Version14000Date20180626223656.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OC\Core\Migrations;
  26. use OCP\DB\ISchemaWrapper;
  27. use OCP\Migration\SimpleMigrationStep;
  28. class Version14000Date20180626223656 extends SimpleMigrationStep {
  29. public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) {
  30. /** @var ISchemaWrapper $schema */
  31. $schema = $schemaClosure();
  32. if (!$schema->hasTable('whats_new')) {
  33. $table = $schema->createTable('whats_new');
  34. $table->addColumn('id', 'integer', [
  35. 'autoincrement' => true,
  36. 'notnull' => true,
  37. 'length' => 4,
  38. 'unsigned' => true,
  39. ]);
  40. $table->addColumn('version', 'string', [
  41. 'notnull' => true,
  42. 'length' => 64,
  43. 'default' => '11',
  44. ]);
  45. $table->addColumn('etag', 'string', [
  46. 'notnull' => true,
  47. 'length' => 64,
  48. 'default' => '',
  49. ]);
  50. $table->addColumn('last_check', 'integer', [
  51. 'notnull' => true,
  52. 'length' => 4,
  53. 'unsigned' => true,
  54. 'default' => 0,
  55. ]);
  56. $table->addColumn('data', 'text', [
  57. 'notnull' => true,
  58. 'default' => '',
  59. ]);
  60. $table->setPrimaryKey(['id']);
  61. $table->addUniqueIndex(['version'], 'version');
  62. $table->addIndex(['version', 'etag'], 'version_etag_idx');
  63. }
  64. return $schema;
  65. }
  66. }