diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-30 19:31:14 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-30 19:33:14 +0200 |
commit | b46207f91176cf944284c01c213d3f69075377a4 (patch) | |
tree | 3d04a46c84c8b66b2d5a56a851249fde80257e28 /db/migrations | |
parent | 6187eed3bb08f200050a3078bd762b5731dfbe78 (diff) | |
parent | 0b0890f425ced27b2204a046296de4cccdac4eb8 (diff) |
Merge remote-tracking branch 'MyIgel/session'
Diffstat (limited to 'db/migrations')
-rw-r--r-- | db/migrations/2018_08_30_000000_create_log_entries_table.php | 12 | ||||
-rw-r--r-- | db/migrations/2018_09_11_000000_create_sessions_table.php | 27 |
2 files changed, 34 insertions, 5 deletions
diff --git a/db/migrations/2018_08_30_000000_create_log_entries_table.php b/db/migrations/2018_08_30_000000_create_log_entries_table.php index 68815434..bef78712 100644 --- a/db/migrations/2018_08_30_000000_create_log_entries_table.php +++ b/db/migrations/2018_08_30_000000_create_log_entries_table.php @@ -17,12 +17,14 @@ class CreateLogEntriesTable extends Migration $table->timestamp('created_at')->nullable(); }); - $this->schema->getConnection()->unprepared(' - INSERT INTO log_entries (`id`, `level`, `message`, `created_at`) - SELECT `id`, `level`, `message`, FROM_UNIXTIME(`timestamp`) FROM LogEntries - '); + if ($this->schema->hasTable('LogEntries')) { + $this->schema->getConnection()->unprepared(' + INSERT INTO log_entries (`id`, `level`, `message`, `created_at`) + SELECT `id`, `level`, `message`, FROM_UNIXTIME(`timestamp`) FROM LogEntries + '); - $this->schema->dropIfExists('LogEntries'); + $this->schema->drop('LogEntries'); + } } /** diff --git a/db/migrations/2018_09_11_000000_create_sessions_table.php b/db/migrations/2018_09_11_000000_create_sessions_table.php new file mode 100644 index 00000000..33a9f569 --- /dev/null +++ b/db/migrations/2018_09_11_000000_create_sessions_table.php @@ -0,0 +1,27 @@ +<?php + +use Engelsystem\Database\Migration\Migration; +use Illuminate\Database\Schema\Blueprint; + +class CreateSessionsTable extends Migration +{ + /** + * Run the migration + */ + public function up() + { + $this->schema->create('sessions', function (Blueprint $table) { + $table->string('id')->unique(); + $table->text('payload'); + $table->dateTime('last_activity')->useCurrent(); + }); + } + + /** + * Reverse the migration + */ + public function down() + { + $this->schema->dropIfExists('sessions'); + } +} |