From 42721e95726559b4a601240bb5b0fe4e5d755b2a Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 27 Nov 2019 23:43:21 +0100 Subject: Added Schedule parsing and replaced old Fahrplan importer Resolves #553 (Change Frab Import from xCal to XML) Resolves #538 (Feature Request: Multi Frab Import) --- ...19_09_07_000001_create_schedule_shift_table.php | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 db/migrations/2019_09_07_000001_create_schedule_shift_table.php (limited to 'db/migrations/2019_09_07_000001_create_schedule_shift_table.php') diff --git a/db/migrations/2019_09_07_000001_create_schedule_shift_table.php b/db/migrations/2019_09_07_000001_create_schedule_shift_table.php new file mode 100644 index 00000000..c9cd7cfe --- /dev/null +++ b/db/migrations/2019_09_07_000001_create_schedule_shift_table.php @@ -0,0 +1,90 @@ +schema->create( + 'schedules', + function (Blueprint $table) { + $table->increments('id'); + $table->string('url'); + } + ); + + $this->schema->create( + 'schedule_shift', + function (Blueprint $table) { + $table->integer('shift_id')->index()->unique(); + if ($this->schema->hasTable('Shifts')) { + // Legacy table access + $table->foreign('shift_id') + ->references('SID')->on('Shifts') + ->onUpdate('cascade') + ->onDelete('cascade'); + } + + $this->references($table, 'schedules'); + $table->uuid('guid'); + } + ); + + if ($this->schema->hasTable('Shifts')) { + $this->schema->table( + 'Shifts', + function (Blueprint $table) { + $table->dropColumn('PSID'); + } + ); + } + + if ($this->schema->hasTable('Room')) { + $this->schema->table( + 'Room', + function (Blueprint $table) { + $table->dropColumn('from_frab'); + } + ); + } + } + + /** + * Reverse the migration + */ + public function down() + { + if ($this->schema->hasTable('Room')) { + $this->schema->table( + 'Room', + function (Blueprint $table) { + $table->boolean('from_frab') + ->default(false); + } + ); + } + + if ($this->schema->hasTable('Shifts')) { + $this->schema->table( + 'Shifts', + function (Blueprint $table) { + $table->integer('PSID') + ->nullable()->default(null) + ->unique(); + } + ); + } + + $this->schema->drop('schedule_shift'); + $this->schema->drop('schedules'); + } +} -- cgit v1.2.3-54-g00ecf