diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index cf6b776..573ed66 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -19,6 +19,7 @@ return new class extends Migration $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); + $table->boolean('admin')->default(0); $table->rememberToken(); $table->timestamps(); }); diff --git a/database/migrations/2022_11_17_002410_create_programs_table.php b/database/migrations/2022_11_17_002410_create_programs_table.php new file mode 100644 index 0000000..1006be3 --- /dev/null +++ b/database/migrations/2022_11_17_002410_create_programs_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('name'); + $table->string('description'); + $table->boolean('active')->default(1); + $table->unsignedInteger('major_version')->default(1); + $table->unsignedInteger('minor_version')->default(0); + $table->unsignedInteger('revision_version')->default(0); + $table->timestamp('last_updated')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('programs'); + } +} diff --git a/database/migrations/2022_11_17_002411_create_sessions_table.php b/database/migrations/2022_11_17_002411_create_sessions_table.php new file mode 100644 index 0000000..d2fa202 --- /dev/null +++ b/database/migrations/2022_11_17_002411_create_sessions_table.php @@ -0,0 +1,43 @@ +uuid('id')->primary(); + $table->boolean('terminated'); + $table->foreignId('user_id') + ->constrained('users') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->foreignId('program_id') + ->constrained('programs') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->timestamp('creation_time')->nullable(); + $table->timestamp('last_ping_time')->nullable(); + $table->ipAddress('ip'); + $table->string('os_username')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sessions'); + } +} diff --git a/database/migrations/2022_11_17_002412_create_activity_logs_table.php b/database/migrations/2022_11_17_002412_create_activity_logs_table.php new file mode 100644 index 0000000..24f98a0 --- /dev/null +++ b/database/migrations/2022_11_17_002412_create_activity_logs_table.php @@ -0,0 +1,46 @@ +id(); + $table->foreignUuid('session_id') + ->nullable() + ->constrained('sessions'); + $table->foreignId('user_id') + ->nullable() + ->constrained('users') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->foreignId('program_id') + ->nullable() + ->constrained('programs') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->ipAddress('ip'); + $table->timestamp('activity_time')->nullable(); + $table->string('action', 50); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('activity_logs'); + } +} diff --git a/database/migrations/2022_11_17_002413_create_groups_table.php b/database/migrations/2022_11_17_002413_create_groups_table.php new file mode 100644 index 0000000..54593dc --- /dev/null +++ b/database/migrations/2022_11_17_002413_create_groups_table.php @@ -0,0 +1,35 @@ +id(); + $table->unsignedInteger('program_limit'); + $table->unsignedInteger('update_limit'); + $table->unsignedInteger('support_ticket_limit'); + $table->string('name', 100); + $table->text('description'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('groups'); + } +} diff --git a/database/migrations/2022_11_17_002414_create_ip_bans_table.php b/database/migrations/2022_11_17_002414_create_ip_bans_table.php new file mode 100644 index 0000000..e9f3936 --- /dev/null +++ b/database/migrations/2022_11_17_002414_create_ip_bans_table.php @@ -0,0 +1,34 @@ +id(); + $table->ipAddress('ip'); + $table->timestamp('creation_time')->nullable(); + $table->timestamp('expiration_time')->nullable(); + $table->string('reason')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('ip_bans'); + } +} diff --git a/database/migrations/2022_11_17_002415_create_link_logs_table.php b/database/migrations/2022_11_17_002415_create_link_logs_table.php new file mode 100644 index 0000000..acf690c --- /dev/null +++ b/database/migrations/2022_11_17_002415_create_link_logs_table.php @@ -0,0 +1,42 @@ +id(); + $table->foreignUuid('session_id') + ->constrained('sessions'); + $table->foreignId('user_id') + ->constrained('users') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->foreignId('program_id') + ->constrained('programs') + ->cascadeOnUpdate() + ->cascadeOnDelete(); + $table->timestamp('server_time')->nullable(); + $table->string('url'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('link_logs'); + } +} diff --git a/database/migrations/2022_11_17_002417_create_permissions_table.php b/database/migrations/2022_11_17_002417_create_permissions_table.php new file mode 100644 index 0000000..9499cf6 --- /dev/null +++ b/database/migrations/2022_11_17_002417_create_permissions_table.php @@ -0,0 +1,36 @@ +id(); + $table->unsignedInteger('user_id'); + $table->unsignedInteger('program_id'); + $table->timestamp('expiration_time')->nullable(); + $table->unsignedInteger('max_session_count')->default(1); + + $table->unique(['user_id', 'program_id'], 'user_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('permissions'); + } +} diff --git a/database/migrations/2022_11_17_002420_create_settings_table.php b/database/migrations/2022_11_17_002420_create_settings_table.php new file mode 100644 index 0000000..a5aa637 --- /dev/null +++ b/database/migrations/2022_11_17_002420_create_settings_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('display_name', 100); + $table->string('display_desc'); + $table->string('name', 100)->unique('name'); + $table->string('value'); + $table->char('data_type', 10)->default('string'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('settings'); + } +}