From 75cb112f9ec9864bffc8330618556476fd72bd50 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2016 15:42:25 -0500 Subject: [PATCH] Update migrations --- database/migrations/.gitkeep | 0 .../2015_11_15_220208_create_users_table.php | 106 ------------------ ...15_11_17_011842_add_remeberme_to_users.php | 35 ------ .../2015_11_17_215442_add_shortcode_uuid.php | 31 ----- .../2015_11_28_021531_create_api_table.php | 33 ------ ...15_11_28_022152_create_api_permissions.php | 31 ----- ...2015_12_03_174421_add_index_to_servers.php | 31 ----- ..._12_03_211643_add_timestamps_to_tables.php | 87 -------------- ..._222146_add_timestamps_service_options.php | 32 ------ ...22200_add_timestamps_service_variables.php | 32 ------ ...222213_add_timestamps_server_variables.php | 32 ------ ...15_12_10_214921_modify_services_images.php | 31 ----- ...16_add_docker_image_to_service_options.php | 43 ------- .../2015_12_10_223449_allow_null_regex.php | 29 ----- ...015_12_11_034958_remove_daemon_startup.php | 31 ----- ...015_12_11_041109_add_service_to_Server.php | 33 ------ ..._12_12_031511_add_node_resource_limits.php | 33 ------ .../2015_12_15_175100_remove_daemon_table.php | 36 ------ .../2015_12_31_210400_add_https_toggle.php | 31 ----- ...2016_01_01_225931_node_https_to_scheme.php | 33 ------ ..._000500_downloads_server_int_to_string.php | 27 ----- ...16_01_02_023924_add_new_server_options.php | 35 ------ ...16_01_02_024253_modify_service_options.php | 33 ------ ..._02_024552_modify_services_add_startup.php | 33 ------ .../2016_01_02_193904_remove_username.php | 31 ----- .../2016_01_03_204358_add_service_file.php | 31 ----- ...16_01_03_210418_add_service_option_tag.php | 31 ----- .../2016_01_04_232911_remove_node_ip.php | 31 ----- ...016_01_12_035038_fix_node_scheme_field.php | 31 ----- .../2016_01_17_005834_modify_api_keys.php | 31 ----- ...16_01_23_195641_add_allocations_table.php} | 15 ++- ...php => 2016_01_23_195851_add_api_keys.php} | 6 +- ...2016_01_23_200044_add_api_permissions.php} | 6 +- ...hp => 2016_01_23_200159_add_downloads.php} | 8 +- ...01_23_200421_create_failed_jobs_table.php} | 0 ...> 2016_01_23_200440_create_jobs_table.php} | 0 ...hp => 2016_01_23_200528_add_locations.php} | 12 +- .../2016_01_23_200648_add_nodes.php | 43 +++++++ ...2016_01_23_201433_add_password_resets.php} | 8 +- ... => 2016_01_23_201531_add_permissions.php} | 9 +- ...016_01_23_201649_add_server_variables.php} | 7 +- .../2016_01_23_201748_add_servers.php | 50 +++++++++ ...2016_01_23_202544_add_service_options.php} | 12 +- ...016_01_23_202731_add_service_varibles.php} | 15 +-- ...php => 2016_01_23_202943_add_services.php} | 11 +- ...16_01_23_203119_create_settings_table.php} | 2 +- ...php => 2016_01_23_203150_add_subusers.php} | 9 +- .../2016_01_23_203159_add_users.php | 38 +++++++ ...016_01_23_203947_create_sessions_table.php | 34 ++++++ 49 files changed, 229 insertions(+), 1120 deletions(-) delete mode 100644 database/migrations/.gitkeep delete mode 100644 database/migrations/2015_11_15_220208_create_users_table.php delete mode 100644 database/migrations/2015_11_17_011842_add_remeberme_to_users.php delete mode 100644 database/migrations/2015_11_17_215442_add_shortcode_uuid.php delete mode 100644 database/migrations/2015_11_28_021531_create_api_table.php delete mode 100644 database/migrations/2015_11_28_022152_create_api_permissions.php delete mode 100644 database/migrations/2015_12_03_174421_add_index_to_servers.php delete mode 100644 database/migrations/2015_12_03_211643_add_timestamps_to_tables.php delete mode 100644 database/migrations/2015_12_08_222146_add_timestamps_service_options.php delete mode 100644 database/migrations/2015_12_08_222200_add_timestamps_service_variables.php delete mode 100644 database/migrations/2015_12_08_222213_add_timestamps_server_variables.php delete mode 100644 database/migrations/2015_12_10_214921_modify_services_images.php delete mode 100644 database/migrations/2015_12_10_215116_add_docker_image_to_service_options.php delete mode 100644 database/migrations/2015_12_10_223449_allow_null_regex.php delete mode 100644 database/migrations/2015_12_11_034958_remove_daemon_startup.php delete mode 100644 database/migrations/2015_12_11_041109_add_service_to_Server.php delete mode 100644 database/migrations/2015_12_12_031511_add_node_resource_limits.php delete mode 100644 database/migrations/2015_12_15_175100_remove_daemon_table.php delete mode 100644 database/migrations/2015_12_31_210400_add_https_toggle.php delete mode 100644 database/migrations/2016_01_01_225931_node_https_to_scheme.php delete mode 100644 database/migrations/2016_01_02_000500_downloads_server_int_to_string.php delete mode 100644 database/migrations/2016_01_02_023924_add_new_server_options.php delete mode 100644 database/migrations/2016_01_02_024253_modify_service_options.php delete mode 100644 database/migrations/2016_01_02_024552_modify_services_add_startup.php delete mode 100644 database/migrations/2016_01_02_193904_remove_username.php delete mode 100644 database/migrations/2016_01_03_204358_add_service_file.php delete mode 100644 database/migrations/2016_01_03_210418_add_service_option_tag.php delete mode 100644 database/migrations/2016_01_04_232911_remove_node_ip.php delete mode 100644 database/migrations/2016_01_12_035038_fix_node_scheme_field.php delete mode 100644 database/migrations/2016_01_17_005834_modify_api_keys.php rename database/migrations/{2015_12_07_043347_add_assigned_to.php => 2016_01_23_195641_add_allocations_table.php} (50%) rename database/migrations/{2016_01_15_231502_create_table_api_keys.php => 2016_01_23_195851_add_api_keys.php} (82%) rename database/migrations/{2016_01_15_233110_create_table_api_permissions.php => 2016_01_23_200044_add_api_permissions.php} (76%) rename database/migrations/{2015_12_03_210410_add_downloads_table.php => 2016_01_23_200159_add_downloads.php} (75%) rename database/migrations/{2016_01_18_235846_create_failed_jobs_table.php => 2016_01_23_200421_create_failed_jobs_table.php} (100%) rename database/migrations/{2016_01_18_235655_create_jobs_table.php => 2016_01_23_200440_create_jobs_table.php} (100%) rename database/migrations/{2015_12_08_222131_add_timestamps_services.php => 2016_01_23_200528_add_locations.php} (56%) create mode 100644 database/migrations/2016_01_23_200648_add_nodes.php rename database/migrations/{2015_11_17_013242_create_password_resets_table.php => 2016_01_23_201433_add_password_resets.php} (69%) rename database/migrations/{2015_11_20_021218_make_permissions_table.php => 2016_01_23_201531_add_permissions.php} (71%) rename database/migrations/{2015_12_08_030810_add_server_variables.php => 2016_01_23_201649_add_server_variables.php} (78%) create mode 100644 database/migrations/2016_01_23_201748_add_servers.php rename database/migrations/{2015_12_08_024433_add_service_options_table.php => 2016_01_23_202544_add_service_options.php} (66%) rename database/migrations/{2015_12_08_030037_add_service_option_variables.php => 2016_01_23_202731_add_service_varibles.php} (61%) rename database/migrations/{2015_12_08_023034_add_services_table.php => 2016_01_23_202943_add_services.php} (64%) rename database/migrations/{2016_01_21_015230_create_settings_table.php => 2016_01_23_203119_create_settings_table.php} (92%) rename database/migrations/{2015_11_20_023901_make_subusers_table.php => 2016_01_23_203150_add_subusers.php} (70%) create mode 100644 database/migrations/2016_01_23_203159_add_users.php create mode 100644 database/migrations/2016_01_23_203947_create_sessions_table.php diff --git a/database/migrations/.gitkeep b/database/migrations/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/database/migrations/2015_11_15_220208_create_users_table.php b/database/migrations/2015_11_15_220208_create_users_table.php deleted file mode 100644 index a8aca95dd..000000000 --- a/database/migrations/2015_11_15_220208_create_users_table.php +++ /dev/null @@ -1,106 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2015_11_17_011842_add_remeberme_to_users.php b/database/migrations/2015_11_17_011842_add_remeberme_to_users.php deleted file mode 100644 index e0ac2123a..000000000 --- a/database/migrations/2015_11_17_011842_add_remeberme_to_users.php +++ /dev/null @@ -1,35 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2015_11_17_215442_add_shortcode_uuid.php b/database/migrations/2015_11_17_215442_add_shortcode_uuid.php deleted file mode 100644 index 28b8611a8..000000000 --- a/database/migrations/2015_11_17_215442_add_shortcode_uuid.php +++ /dev/null @@ -1,31 +0,0 @@ -char('uuidShort', 8)->after('uuid')->unique(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('servers', function (Blueprint $table) { - $table->dropColumn('uuidShort'); - }); - } -} diff --git a/database/migrations/2015_11_28_021531_create_api_table.php b/database/migrations/2015_11_28_021531_create_api_table.php deleted file mode 100644 index 5a98e2eaa..000000000 --- a/database/migrations/2015_11_28_021531_create_api_table.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2015_11_28_022152_create_api_permissions.php b/database/migrations/2015_11_28_022152_create_api_permissions.php deleted file mode 100644 index e001532a6..000000000 --- a/database/migrations/2015_11_28_022152_create_api_permissions.php +++ /dev/null @@ -1,31 +0,0 @@ -increments('id')->unsigned(); - $table->integer('key_id')->unsigned(); - $table->string('permission'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('api_permissions'); - } -} diff --git a/database/migrations/2015_12_03_174421_add_index_to_servers.php b/database/migrations/2015_12_03_174421_add_index_to_servers.php deleted file mode 100644 index b5662cddc..000000000 --- a/database/migrations/2015_12_03_174421_add_index_to_servers.php +++ /dev/null @@ -1,31 +0,0 @@ -index('uuidShort'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('servers', function (Blueprint $table) { - $table->dropIndex('uuidShort'); - }); - } -} diff --git a/database/migrations/2015_12_03_211643_add_timestamps_to_tables.php b/database/migrations/2015_12_03_211643_add_timestamps_to_tables.php deleted file mode 100644 index 67f42601e..000000000 --- a/database/migrations/2015_12_03_211643_add_timestamps_to_tables.php +++ /dev/null @@ -1,87 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2015_12_08_222146_add_timestamps_service_options.php b/database/migrations/2015_12_08_222146_add_timestamps_service_options.php deleted file mode 100644 index 7749b555c..000000000 --- a/database/migrations/2015_12_08_222146_add_timestamps_service_options.php +++ /dev/null @@ -1,32 +0,0 @@ -timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('service_options', function (Blueprint $table) { - $table->dropColumn('created_at'); - $table->dropColumn('updated_at'); - }); - } -} diff --git a/database/migrations/2015_12_08_222200_add_timestamps_service_variables.php b/database/migrations/2015_12_08_222200_add_timestamps_service_variables.php deleted file mode 100644 index e2bcfc2b8..000000000 --- a/database/migrations/2015_12_08_222200_add_timestamps_service_variables.php +++ /dev/null @@ -1,32 +0,0 @@ -timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('service_variables', function (Blueprint $table) { - $table->dropColumn('created_at'); - $table->dropColumn('updated_at'); - }); - } -} diff --git a/database/migrations/2015_12_08_222213_add_timestamps_server_variables.php b/database/migrations/2015_12_08_222213_add_timestamps_server_variables.php deleted file mode 100644 index 11c91a34d..000000000 --- a/database/migrations/2015_12_08_222213_add_timestamps_server_variables.php +++ /dev/null @@ -1,32 +0,0 @@ -timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('server_variables', function (Blueprint $table) { - $table->dropColumn('created_at'); - $table->dropColumn('updated_at'); - }); - } -} diff --git a/database/migrations/2015_12_10_214921_modify_services_images.php b/database/migrations/2015_12_10_214921_modify_services_images.php deleted file mode 100644 index 0e2d35d20..000000000 --- a/database/migrations/2015_12_10_214921_modify_services_images.php +++ /dev/null @@ -1,31 +0,0 @@ -dropColumn('docker_image'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('services', function (Blueprint $table) { - $table->string('docker_image')->after('description'); - }); - } -} diff --git a/database/migrations/2015_12_10_215116_add_docker_image_to_service_options.php b/database/migrations/2015_12_10_215116_add_docker_image_to_service_options.php deleted file mode 100644 index ca2197987..000000000 --- a/database/migrations/2015_12_10_215116_add_docker_image_to_service_options.php +++ /dev/null @@ -1,43 +0,0 @@ -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(); - }); - - } -} diff --git a/database/migrations/2015_12_10_223449_allow_null_regex.php b/database/migrations/2015_12_10_223449_allow_null_regex.php deleted file mode 100644 index fd720d40c..000000000 --- a/database/migrations/2015_12_10_223449_allow_null_regex.php +++ /dev/null @@ -1,29 +0,0 @@ -string('regex')->nullable()->change(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - DB::statement('ALTER TABLE `service_variables` MODIFY `regex` VARCHAR(255) NOT NULL'); - } -} diff --git a/database/migrations/2015_12_11_034958_remove_daemon_startup.php b/database/migrations/2015_12_11_034958_remove_daemon_startup.php deleted file mode 100644 index 026e6ad68..000000000 --- a/database/migrations/2015_12_11_034958_remove_daemon_startup.php +++ /dev/null @@ -1,31 +0,0 @@ -dropColumn('daemonStartup'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('servers', function (Blueprint $table) { - $table->text('daemonStartup')->after('port')->nullable(); - }); - } -} diff --git a/database/migrations/2015_12_11_041109_add_service_to_Server.php b/database/migrations/2015_12_11_041109_add_service_to_Server.php deleted file mode 100644 index 725943fca..000000000 --- a/database/migrations/2015_12_11_041109_add_service_to_Server.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2015_12_12_031511_add_node_resource_limits.php b/database/migrations/2015_12_12_031511_add_node_resource_limits.php deleted file mode 100644 index 54aa0ad38..000000000 --- a/database/migrations/2015_12_12_031511_add_node_resource_limits.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2015_12_15_175100_remove_daemon_table.php b/database/migrations/2015_12_15_175100_remove_daemon_table.php deleted file mode 100644 index b6fb8b20d..000000000 --- a/database/migrations/2015_12_15_175100_remove_daemon_table.php +++ /dev/null @@ -1,36 +0,0 @@ -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(); - }); - } -} diff --git a/database/migrations/2015_12_31_210400_add_https_toggle.php b/database/migrations/2015_12_31_210400_add_https_toggle.php deleted file mode 100644 index 7a39e5ce7..000000000 --- a/database/migrations/2015_12_31_210400_add_https_toggle.php +++ /dev/null @@ -1,31 +0,0 @@ -boolean('https')->after('fqdn')->default(false); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('nodes', function (Blueprint $table) { - $table->dropColumn('https'); - }); - } -} diff --git a/database/migrations/2016_01_01_225931_node_https_to_scheme.php b/database/migrations/2016_01_01_225931_node_https_to_scheme.php deleted file mode 100644 index a5affdf92..000000000 --- a/database/migrations/2016_01_01_225931_node_https_to_scheme.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2016_01_02_000500_downloads_server_int_to_string.php b/database/migrations/2016_01_02_000500_downloads_server_int_to_string.php deleted file mode 100644 index 0dd00a602..000000000 --- a/database/migrations/2016_01_02_000500_downloads_server_int_to_string.php +++ /dev/null @@ -1,27 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2016_01_02_024253_modify_service_options.php b/database/migrations/2016_01_02_024253_modify_service_options.php deleted file mode 100644 index 840da3bd4..000000000 --- a/database/migrations/2016_01_02_024253_modify_service_options.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2016_01_02_024552_modify_services_add_startup.php b/database/migrations/2016_01_02_024552_modify_services_add_startup.php deleted file mode 100644 index 38214a7b1..000000000 --- a/database/migrations/2016_01_02_024552_modify_services_add_startup.php +++ /dev/null @@ -1,33 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2016_01_02_193904_remove_username.php b/database/migrations/2016_01_02_193904_remove_username.php deleted file mode 100644 index b0ec551aa..000000000 --- a/database/migrations/2016_01_02_193904_remove_username.php +++ /dev/null @@ -1,31 +0,0 @@ -dropColumn('username'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('users', function (Blueprint $table) { - $table->string('username')->after('uuid'); - }); - } -} diff --git a/database/migrations/2016_01_03_204358_add_service_file.php b/database/migrations/2016_01_03_204358_add_service_file.php deleted file mode 100644 index 5fff69aaf..000000000 --- a/database/migrations/2016_01_03_204358_add_service_file.php +++ /dev/null @@ -1,31 +0,0 @@ -string('file')->after('description'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('services', function (Blueprint $table) { - $table->dropColumn('file'); - }); - } -} diff --git a/database/migrations/2016_01_03_210418_add_service_option_tag.php b/database/migrations/2016_01_03_210418_add_service_option_tag.php deleted file mode 100644 index d565c8532..000000000 --- a/database/migrations/2016_01_03_210418_add_service_option_tag.php +++ /dev/null @@ -1,31 +0,0 @@ -string('tag')->after('description'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('service_options', function (Blueprint $table) { - $table->dropColumn('tag'); - }); - } -} diff --git a/database/migrations/2016_01_04_232911_remove_node_ip.php b/database/migrations/2016_01_04_232911_remove_node_ip.php deleted file mode 100644 index b8f9072a8..000000000 --- a/database/migrations/2016_01_04_232911_remove_node_ip.php +++ /dev/null @@ -1,31 +0,0 @@ -dropColumn('ip'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('nodes', function (Blueprint $table) { - $table->string('ip')->after('fqdn'); - }); - } -} diff --git a/database/migrations/2016_01_12_035038_fix_node_scheme_field.php b/database/migrations/2016_01_12_035038_fix_node_scheme_field.php deleted file mode 100644 index c88096608..000000000 --- a/database/migrations/2016_01_12_035038_fix_node_scheme_field.php +++ /dev/null @@ -1,31 +0,0 @@ -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'); } } diff --git a/database/migrations/2016_01_15_231502_create_table_api_keys.php b/database/migrations/2016_01_23_195851_add_api_keys.php similarity index 82% rename from database/migrations/2016_01_15_231502_create_table_api_keys.php rename to database/migrations/2016_01_23_195851_add_api_keys.php index 9b1fb4bb7..6c1313e24 100644 --- a/database/migrations/2016_01_15_231502_create_table_api_keys.php +++ b/database/migrations/2016_01_23_195851_add_api_keys.php @@ -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'); } } diff --git a/database/migrations/2016_01_15_233110_create_table_api_permissions.php b/database/migrations/2016_01_23_200044_add_api_permissions.php similarity index 76% rename from database/migrations/2016_01_15_233110_create_table_api_permissions.php rename to database/migrations/2016_01_23_200044_add_api_permissions.php index 9056003b9..f1843aad5 100644 --- a/database/migrations/2016_01_15_233110_create_table_api_permissions.php +++ b/database/migrations/2016_01_23_200044_add_api_permissions.php @@ -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'); } } diff --git a/database/migrations/2015_12_03_210410_add_downloads_table.php b/database/migrations/2016_01_23_200159_add_downloads.php similarity index 75% rename from database/migrations/2015_12_03_210410_add_downloads_table.php rename to database/migrations/2016_01_23_200159_add_downloads.php index 96a591f12..f1c192432 100644 --- a/database/migrations/2015_12_03_210410_add_downloads_table.php +++ b/database/migrations/2016_01_23_200159_add_downloads.php @@ -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'); } } diff --git a/database/migrations/2016_01_18_235846_create_failed_jobs_table.php b/database/migrations/2016_01_23_200421_create_failed_jobs_table.php similarity index 100% rename from database/migrations/2016_01_18_235846_create_failed_jobs_table.php rename to database/migrations/2016_01_23_200421_create_failed_jobs_table.php diff --git a/database/migrations/2016_01_18_235655_create_jobs_table.php b/database/migrations/2016_01_23_200440_create_jobs_table.php similarity index 100% rename from database/migrations/2016_01_18_235655_create_jobs_table.php rename to database/migrations/2016_01_23_200440_create_jobs_table.php diff --git a/database/migrations/2015_12_08_222131_add_timestamps_services.php b/database/migrations/2016_01_23_200528_add_locations.php similarity index 56% rename from database/migrations/2015_12_08_222131_add_timestamps_services.php rename to database/migrations/2016_01_23_200528_add_locations.php index e9455a132..6ad7de75b 100644 --- a/database/migrations/2015_12_08_222131_add_timestamps_services.php +++ b/database/migrations/2016_01_23_200528_add_locations.php @@ -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'); } } diff --git a/database/migrations/2016_01_23_200648_add_nodes.php b/database/migrations/2016_01_23_200648_add_nodes.php new file mode 100644 index 000000000..57613cabd --- /dev/null +++ b/database/migrations/2016_01_23_200648_add_nodes.php @@ -0,0 +1,43 @@ +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'); + } +} diff --git a/database/migrations/2015_11_17_013242_create_password_resets_table.php b/database/migrations/2016_01_23_201433_add_password_resets.php similarity index 69% rename from database/migrations/2015_11_17_013242_create_password_resets_table.php rename to database/migrations/2016_01_23_201433_add_password_resets.php index 8f0509d65..45454b801 100644 --- a/database/migrations/2015_11_17_013242_create_password_resets_table.php +++ b/database/migrations/2016_01_23_201433_add_password_resets.php @@ -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'); } } diff --git a/database/migrations/2015_11_20_021218_make_permissions_table.php b/database/migrations/2016_01_23_201531_add_permissions.php similarity index 71% rename from database/migrations/2015_11_20_021218_make_permissions_table.php rename to database/migrations/2016_01_23_201531_add_permissions.php index e83a42204..bf6327ac6 100644 --- a/database/migrations/2015_11_20_021218_make_permissions_table.php +++ b/database/migrations/2016_01_23_201531_add_permissions.php @@ -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'); } } diff --git a/database/migrations/2015_12_08_030810_add_server_variables.php b/database/migrations/2016_01_23_201649_add_server_variables.php similarity index 78% rename from database/migrations/2015_12_08_030810_add_server_variables.php rename to database/migrations/2016_01_23_201649_add_server_variables.php index ae430e9fb..bfbb4b99d 100644 --- a/database/migrations/2015_12_08_030810_add_server_variables.php +++ b/database/migrations/2016_01_23_201649_add_server_variables.php @@ -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) { + // + }); } } diff --git a/database/migrations/2016_01_23_201748_add_servers.php b/database/migrations/2016_01_23_201748_add_servers.php new file mode 100644 index 000000000..f4ae554c7 --- /dev/null +++ b/database/migrations/2016_01_23_201748_add_servers.php @@ -0,0 +1,50 @@ +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'); + } +} diff --git a/database/migrations/2015_12_08_024433_add_service_options_table.php b/database/migrations/2016_01_23_202544_add_service_options.php similarity index 66% rename from database/migrations/2015_12_08_024433_add_service_options_table.php rename to database/migrations/2016_01_23_202544_add_service_options.php index 0b967594b..1a05caec8 100644 --- a/database/migrations/2015_12_08_024433_add_service_options_table.php +++ b/database/migrations/2016_01_23_202544_add_service_options.php @@ -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'); } } diff --git a/database/migrations/2015_12_08_030037_add_service_option_variables.php b/database/migrations/2016_01_23_202731_add_service_varibles.php similarity index 61% rename from database/migrations/2015_12_08_030037_add_service_option_variables.php rename to database/migrations/2016_01_23_202731_add_service_varibles.php index 3791ca32e..5ea938986 100644 --- a/database/migrations/2015_12_08_030037_add_service_option_variables.php +++ b/database/migrations/2016_01_23_202731_add_service_varibles.php @@ -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'); } } diff --git a/database/migrations/2015_12_08_023034_add_services_table.php b/database/migrations/2016_01_23_202943_add_services.php similarity index 64% rename from database/migrations/2015_12_08_023034_add_services_table.php rename to database/migrations/2016_01_23_202943_add_services.php index a3d9582af..c837dc923 100644 --- a/database/migrations/2015_12_08_023034_add_services_table.php +++ b/database/migrations/2016_01_23_202943_add_services.php @@ -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'); } } diff --git a/database/migrations/2016_01_21_015230_create_settings_table.php b/database/migrations/2016_01_23_203119_create_settings_table.php similarity index 92% rename from database/migrations/2016_01_21_015230_create_settings_table.php rename to database/migrations/2016_01_23_203119_create_settings_table.php index 657f1ba1b..0e2c0cbfe 100644 --- a/database/migrations/2016_01_21_015230_create_settings_table.php +++ b/database/migrations/2016_01_23_203119_create_settings_table.php @@ -25,6 +25,6 @@ class CreateSettingsTable extends Migration */ public function down() { - Schema::drop('settings'); + Schema::dropIfExists('settings'); } } diff --git a/database/migrations/2015_11_20_023901_make_subusers_table.php b/database/migrations/2016_01_23_203150_add_subusers.php similarity index 70% rename from database/migrations/2015_11_20_023901_make_subusers_table.php rename to database/migrations/2016_01_23_203150_add_subusers.php index 32016cdb8..1cc8e334c 100644 --- a/database/migrations/2015_11_20_023901_make_subusers_table.php +++ b/database/migrations/2016_01_23_203150_add_subusers.php @@ -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'); } } diff --git a/database/migrations/2016_01_23_203159_add_users.php b/database/migrations/2016_01_23_203159_add_users.php new file mode 100644 index 000000000..14e28eeba --- /dev/null +++ b/database/migrations/2016_01_23_203159_add_users.php @@ -0,0 +1,38 @@ +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'); + } +} diff --git a/database/migrations/2016_01_23_203947_create_sessions_table.php b/database/migrations/2016_01_23_203947_create_sessions_table.php new file mode 100644 index 000000000..f1c84aa4b --- /dev/null +++ b/database/migrations/2016_01_23_203947_create_sessions_table.php @@ -0,0 +1,34 @@ +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'); + } +}