Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'database/migrations/2016_03_05_043127_migrate_1x_to_2x_users.php')
-rw-r--r--database/migrations/2016_03_05_043127_migrate_1x_to_2x_users.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/database/migrations/2016_03_05_043127_migrate_1x_to_2x_users.php b/database/migrations/2016_03_05_043127_migrate_1x_to_2x_users.php
new file mode 100644
index 0000000..8c84195
--- /dev/null
+++ b/database/migrations/2016_03_05_043127_migrate_1x_to_2x_users.php
@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class Migrate1xTo2xUsers extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::rename('auth', 'users');
+
+ Schema::table('users', function (Blueprint $table) {
+ // Rename needed columns
+ $table->renameColumn('rkey', 'recovery_key');
+ $table->renameColumn('valid', 'active');
+ $table->renameColumn('uid', 'id');
+
+ // Drop unused columns
+ $table->dropColumn('theme');
+
+ // Create new columns
+ $table->string('api_key')->nullable();
+ $table->boolean('api_active')->default(0);
+ $table->string('api_quota')->default(60);
+
+ $table->timestamps();
+ $table->softDeletes();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ //
+ });
+ }
+}