Update migrations

This commit is contained in:
Dane Everitt 2016-01-23 15:42:25 -05:00
parent 5ce6b00f54
commit 75cb112f9e
49 changed files with 229 additions and 1120 deletions

View file

@ -1,106 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->char('uuid', 36)->unique();
$table->string('username')->nullable();
$table->string('email')->unique();
$table->text('password');
$table->char('language', 2);
$table->char('session_id', 12);
$table->string('session_ip');
$table->tinyInteger('root_admin')->unsigned();
$table->tinyInteger('use_totp')->unsigned();
$table->char('totp_secret', 16);
$table->timestamps();
});
Schema::create('locations', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('short')->unique();
$table->string('long');
});
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->smallInteger('public')->unsigned();
$table->string('name');
$table->mediumInteger('location')->unsigned();
$table->string('fqdn')->unique();
$table->string('ip');
$table->integer('memory')->unsigned();
$table->integer('disk')->unsigned();
$table->char('daemonSecret', 36)->unique();
$table->smallInteger('daemonListen')->unsigned()->default(5656);
$table->smallInteger('daemonSFTP')->unsigned()->default(22);
$table->string('daemonBase')->default('/home/');
});
Schema::create('servers', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->char('uuid', 36)->unique();
$table->mediumInteger('node')->unsigned();
$table->string('name');
$table->tinyInteger('active')->unsigned();
$table->mediumInteger('owner')->unsigned();
$table->integer('memory')->unsigned();
$table->integer('disk')->unsigned();
$table->integer('io')->unsigned();
$table->integer('cpu')->unsigned();
$table->string('ip');
$table->integer('port')->unsigned();
$table->text('daemonStartup')->nullable();
$table->text('daemonSecret');
$table->string('username');
$table->integer('installed')->unsigned()->default(0);
$table->timestamps();
});
Schema::create('daemon', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->mediumInteger('server')->unsigned();
$table->string('parameter');
$table->text('value');
$table->tinyInteger('editable')->unsigned()->default(0);
$table->tinyInteger('visible')->unsigned()->default(0);
$table->text('regex')->nullable();
$table->timestamps();
});
Schema::create('allocations', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->mediumInteger('node')->unsigned();
$table->string('ip');
$table->mediumInteger('port');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('allocations');
Schema::dropIfExists('daemon');
Schema::dropIfExists('servers');
Schema::dropIfExists('nodes');
Schema::dropIfExists('locations');
Schema::dropIfExists('users');
}
}

View file

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRemebermeToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->rememberToken()->after('password');
$table->dropColumn('session_id');
$table->dropColumn('session_ip');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('remember_token');
$table->char('session_id', 12)->after('language');
$table->string('session_ip')->after('session_id');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddShortcodeUuid extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->char('uuidShort', 8)->after('uuid')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('uuidShort');
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApiTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('api', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->nullable()->unsigned();
$table->char('key', 36)->unique();
$table->json('allowed_ips')->nullable();
$table->index('key');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('api');
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApiPermissions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('api_permissions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('key_id')->unsigned();
$table->string('permission');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('api_permissions');
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIndexToServers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->index('uuidShort');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropIndex('uuidShort');
});
}
}

View file

@ -1,87 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsToTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('allocations', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('api', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('api_permissions', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('locations', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('nodes', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('permissions', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('subusers', function (Blueprint $table) {
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('api', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('api_permissions', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('locations', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('subusers', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
}
}

View file

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsServiceOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_options', function (Blueprint $table) {
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
}
}

View file

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsServiceVariables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_variables', function (Blueprint $table) {
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('service_variables', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
}
}

View file

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsServerVariables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('server_variables', function (Blueprint $table) {
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('server_variables', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyServicesImages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('docker_image');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('services', function (Blueprint $table) {
$table->string('docker_image')->after('description');
});
}
}

View file

@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDockerImageToServiceOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_options', function (Blueprint $table) {
$table->renameColumn('docker_tag', 'docker_image');
});
Schema::table('service_options', function (Blueprint $table) {
$table->text('docker_image')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->renameColumn('docker_image', 'docker_tag');
});
Schema::table('service_options', function (Blueprint $table) {
$table->string('docker_tag')->change();
});
}
}

View file

@ -1,29 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AllowNullRegex extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_variables', function (Blueprint $table) {
$table->string('regex')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('ALTER TABLE `service_variables` MODIFY `regex` VARCHAR(255) NOT NULL');
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveDaemonStartup extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('daemonStartup');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->text('daemonStartup')->after('port')->nullable();
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServiceToServer extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->mediumInteger('service')->unsigned()->after('port');
$table->mediumInteger('option')->unsigned()->after('service');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('service');
$table->dropColumn('option');
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNodeResourceLimits extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->mediumInteger('memory_overallocate')->after('memory')->unsigned()->nullable();
$table->mediumInteger('disk_overallocate')->after('disk')->unsigned()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('memory_overallocate');
$table->dropColumn('disk_overallocate');
});
}
}

View file

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveDaemonTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('daemon');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('daemon', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->mediumInteger('server')->unsigned();
$table->string('parameter');
$table->text('value');
$table->tinyInteger('editable')->unsigned()->default(0);
$table->tinyInteger('visible')->unsigned()->default(0);
$table->text('regex')->nullable();
$table->timestamps();
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddHttpsToggle extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->boolean('https')->after('fqdn')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('https');
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class NodeHttpsToScheme extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->string('https', 5)->default('http')->change();
$table->renameColumn('https', 'scheme');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->boolean('scheme')->default(false)->change();
$table->renameColumn('scheme', 'https');
});
}
}

View file

@ -1,27 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DownloadsServerIntToString extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE `downloads` MODIFY `server` CHAR(36) NOT NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('ALTER TABLE `downloads` MODIFY `server` MEDIUMINT(9) NOT NULL');
}
}

View file

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNewServerOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->boolean('oom_disabled')->default(false)->after('cpu');
$table->mediumInteger('swap')->default(0)->after('memory');
$table->text('startup')->after('option');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('oom_enabled');
$table->dropColumn('swap');
$table->dropColumn('startup');
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyServiceOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('config_file');
$table->dropColumn('config_blob');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->string('config_file')->after('description');
$table->binary('config_blob')->after('config_file');
});
}
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyServicesAddStartup extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('services', function (Blueprint $table) {
$table->text('executable')->after('description');
$table->text('startup')->after('executable');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('executable');
$table->dropColumn('startup');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveUsername extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('username')->after('uuid');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServiceFile extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('services', function (Blueprint $table) {
$table->string('file')->after('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('file');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServiceOptionTag extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('service_options', function (Blueprint $table) {
$table->string('tag')->after('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('tag');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveNodeIp extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('ip');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->string('ip')->after('fqdn');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class FixNodeSchemeField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
DB::statement('ALTER TABLE `nodes` MODIFY `scheme` VARCHAR(5) DEFAULT \'https\' NOT NULL');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
DB::statement('ALTER TABLE `nodes` MODIFY `scheme` BOOLEAN() DEFAULT 0 NOT NULL');
});
}
}

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyApiKeys extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('api_keys', function (Blueprint $table) {
DB::statement('ALTER TABLE `api_keys` MODIFY `secret` TINYTEXT NOT NULL');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('api_keys', function (Blueprint $table) {
DB::statement('ALTER TABLE `api_keys` MODIFY `secret` TINYTEXT NOT NULL');
});
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAssignedTo extends Migration
class AddAllocationsTable extends Migration
{
/**
* Run the migrations.
@ -12,8 +12,13 @@ class AddAssignedTo extends Migration
*/
public function up()
{
Schema::table('allocations', function (Blueprint $table) {
$table->mediumInteger('assigned_to')->unsigned()->nullable()->after('port');
Schema::create('allocations', function (Blueprint $table) {
$table->increments('id');
$table->mediumInteger('node')->unsigned();
$table->string('ip');
$table->mediumInteger('port')->unsigned();
$table->mediumInteger('assigned_to')->unsigned()->nullable();
$table->timestamps();
});
}
@ -24,8 +29,6 @@ class AddAssignedTo extends Migration
*/
public function down()
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropColumn('assigned_to');
});
Schema::dropIfExsits('allocations');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableApiKeys extends Migration
class AddApiKeys extends Migration
{
/**
* Run the migrations.
@ -15,7 +15,7 @@ class CreateTableApiKeys extends Migration
Schema::create('api_keys', function (Blueprint $table) {
$table->increments('id');
$table->char('public', 16);
$table->char('secret', 32);
$table->text('secret');
$table->json('allowed_ips')->nullable();
$table->timestamps();
});
@ -28,6 +28,6 @@ class CreateTableApiKeys extends Migration
*/
public function down()
{
Schema::drop('api_keys');
Schema::dropIfExists('api_keys');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableApiPermissions extends Migration
class AddApiPermissions extends Migration
{
/**
* Run the migrations.
@ -14,7 +14,7 @@ class CreateTableApiPermissions extends Migration
{
Schema::create('api_permissions', function (Blueprint $table) {
$table->increments('id');
$table->integer('key_id')->unsigned();
$table->mediumInteger('key_id')->unsigned();
$table->string('permission');
});
}
@ -26,6 +26,6 @@ class CreateTableApiPermissions extends Migration
*/
public function down()
{
Schema::drop('api_permissions');
Schema::dropIfExists('api_permissions');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDownloadsTable extends Migration
class AddDownloads extends Migration
{
/**
* Run the migrations.
@ -13,9 +13,9 @@ class AddDownloadsTable extends Migration
public function up()
{
Schema::create('downloads', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->char('token', 36)->unique();
$table->mediumInteger('server');
$table->char('server', 36);
$table->text('path');
$table->timestamps();
});
@ -28,6 +28,6 @@ class AddDownloadsTable extends Migration
*/
public function down()
{
Schema::drop('downloads');
Schema::dropIfExists('downloads');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsServices extends Migration
class AddLocations extends Migration
{
/**
* Run the migrations.
@ -12,7 +12,10 @@ class AddTimestampsServices extends Migration
*/
public function up()
{
Schema::table('services', function (Blueprint $table) {
Schema::create('locations', function (Blueprint $table) {
$table->increments('id');
$table->string('short')->unique();
$table->string('long');
$table->timestamps();
});
}
@ -24,9 +27,6 @@ class AddTimestampsServices extends Migration
*/
public function down()
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::dropIfExists('locations');
}
}

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNodes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id');
$table->smallInteger('public')->unsigned();
$table->string('name');
$table->mediumInteger('location')->unsigned();
$table->string('fqdn');
$table->string('scheme')->default('https');
$table->integer('memory')->unsigned();
$table->mediumInteger('memory_overallocate')->unsigned()->nullable();
$table->integer('disk')->unsigned();
$table->mediumInteger('disk_overallocate')->unsigned()->nullable();
$table->char('daemonSecret', 36)->unique();
$table->smallInteger('daemonListen')->unsigned()->default(8080);
$table->smallInteger('daemonSFTP')->unsgined()->default(2022);
$table->string('daemonBase')->default('/home/daemon-files');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('nodes');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
class AddPasswordResets extends Migration
{
/**
* Run the migrations.
@ -17,10 +17,6 @@ class CreatePasswordResetsTable extends Migration
$table->string('token')->index();
$table->timestamp('created_at');
});
Schema::table('users', function (Blueprint $table) {
$table->string('totp_secret', 16)->nullable()->change();
});
}
/**
@ -30,6 +26,6 @@ class CreatePasswordResetsTable extends Migration
*/
public function down()
{
Schema::drop('password_resets');
Schema::dropIfExists('password_resets');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakePermissionsTable extends Migration
class AddPermissions extends Migration
{
/**
* Run the migrations.
@ -13,10 +13,11 @@ class MakePermissionsTable extends Migration
public function up()
{
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('server_id')->unsigned();
$table->string('permission');
$table->string('permissions');
$table->timestamps();
});
}
@ -27,6 +28,6 @@ class MakePermissionsTable extends Migration
*/
public function down()
{
Schema::drop('permissions');
Schema::dropIfExists('permissions');
}
}

View file

@ -13,10 +13,11 @@ class AddServerVariables extends Migration
public function up()
{
Schema::create('server_variables', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->mediumInteger('server_id')->unsigned();
$table->mediumInteger('variable_id')->unsigned();
$table->string('variable_value');
$table->timestamps();
});
}
@ -27,6 +28,8 @@ class AddServerVariables extends Migration
*/
public function down()
{
Schema::drop('server_variables');
Schema::table('server_variables', function (Blueprint $table) {
//
});
}
}

View file

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('servers', function (Blueprint $table) {
$table->increments('id');
$table->char('uuid', 36)->unique();
$table->char('uuidShort', 8)->unique();
$table->mediumInteger('node')->unsigned();
$table->string('name');
$table->tinyInteger('active')->unsigned();
$table->mediumInteger('owner')->unsigned();
$table->integer('memory')->unsigned();
$table->integer('swap')->unsigned();
$table->integer('disk')->unsigned();
$table->integer('io')->unsigned();
$table->integer('cpu')->unsigned();
$table->tinyInteger('oom_disabled')->unsigned()->default(0);
$table->string('ip');
$table->integer('port')->unsigned();
$table->mediumInteger('service')->unsigned();
$table->mediumInteger('option')->unsigned();
$table->text('startup');
$table->char('daemonSecret', 36)->unique();
$table->string('username')->unique();
$table->tinyInteger('installed')->unsigned()->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('servers');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServiceOptionsTable extends Migration
class AddServiceOptions extends Migration
{
/**
* Run the migrations.
@ -13,13 +13,13 @@ class AddServiceOptionsTable extends Migration
public function up()
{
Schema::create('service_options', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->mediumInteger('parent_service')->unsigned();
$table->string('name');
$table->text('description');
$table->string('config_file');
$table->binary('config_blob')->nullable();
$table->string('docker_tag');
$table->string('tag');
$table->text('docker_image');
$table->timestamps();
});
}
@ -30,6 +30,6 @@ class AddServiceOptionsTable extends Migration
*/
public function down()
{
Schema::drop('service_options');
Schema::dropIfExsits('service_options');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServiceOptionVariables extends Migration
class AddServiceVaribles extends Migration
{
/**
* Run the migrations.
@ -13,16 +13,17 @@ class AddServiceOptionVariables extends Migration
public function up()
{
Schema::create('service_variables', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->mediumInteger('option_id')->unsigned();
$table->string('name');
$table->text('description');
$table->string('env_variable');
$table->string('default_value');
$table->boolean('user_viewable');
$table->boolean('user_editable');
$table->boolean('required');
$table->string('regex');
$table->tinyInteger('user_viewable')->unsigned();
$table->tinyInteger('user_editable')->unsigned();
$table->tinyInteger('required')->unsigned();
$table->string('regex')->nullable();
$table->timestamps();
});
}
@ -33,6 +34,6 @@ class AddServiceOptionVariables extends Migration
*/
public function down()
{
Schema::drop('service_variables');
Schema::dropIfExists('service_variables');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServicesTable extends Migration
class AddServices extends Migration
{
/**
* Run the migrations.
@ -13,10 +13,13 @@ class AddServicesTable extends Migration
public function up()
{
Schema::create('services', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->string('name');
$table->text('description');
$table->string('docker_image');
$table->string('file');
$table->string('executable');
$table->text('startup');
$table->timestamps();
});
}
@ -27,6 +30,6 @@ class AddServicesTable extends Migration
*/
public function down()
{
Schema::drop('services');
Schema::dropIfExists('services');
}
}

View file

@ -25,6 +25,6 @@ class CreateSettingsTable extends Migration
*/
public function down()
{
Schema::drop('settings');
Schema::dropIfExists('settings');
}
}

View file

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeSubusersTable extends Migration
class AddSubusers extends Migration
{
/**
* Run the migrations.
@ -13,10 +13,11 @@ class MakeSubusersTable extends Migration
public function up()
{
Schema::create('subusers', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('server_id')->unsigned();
$table->char('daemonSecret', 36);
$table->char('daemonSecret', 36)->unique();
$table->timestamps();
});
}
@ -27,6 +28,6 @@ class MakeSubusersTable extends Migration
*/
public function down()
{
Schema::drop('subusers');
Schema::dropIfExists('subusers');
}
}

View file

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->char('uuid', 36)->unique();
$table->string('email')->unique();
$table->text('password');
$table->string('remember_token')->nullable();
$table->char('language', 5)->default('en');
$table->tinyInteger('root_admin')->unsigned()->default(0);
$table->tinyInteger('use_totp')->unsigned();
$table->char('totp_secret', 16)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->integer('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
}