diff --git a/database/migrations/2018_11_17_124956_create_users_table.php b/database/migrations/2018_11_17_124956_create_users_table.php new file mode 100644 index 00000000..05c0d827 --- /dev/null +++ b/database/migrations/2018_11_17_124956_create_users_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->string('email')->unique(); + $table->string('password'); + // remeber_token needed https://stackoverflow.com/questions/24954537/is-it-compulsory-to-use-remember-token-field + $table->string('remember_token', 100)->nullable(); + $table->boolean('verified')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('users'); + } +} diff --git a/database/migrations/2018_11_17_133622_create_wiki_dbs_table.php b/database/migrations/2018_11_17_133622_create_wiki_dbs_table.php new file mode 100644 index 00000000..dcc5218b --- /dev/null +++ b/database/migrations/2018_11_17_133622_create_wiki_dbs_table.php @@ -0,0 +1,43 @@ +increments('id'); + + $table->string('name', 100); + $table->string('prefix', 100); + $table->string('user', 100); + $table->string('password', 100); + + // Require the dbname and prefix to be unique... + $table->unique(['name', 'prefix']); + + $table->string('version', 20); + // Index needed so that we can easily query what needs to be updated + $table->index('version'); + + $table->integer('wiki_id')->nullable()->unsigned()->unique(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_dbs'); + } +} diff --git a/database/migrations/2018_11_17_133627_create_wikis_table.php b/database/migrations/2018_11_17_133627_create_wikis_table.php new file mode 100644 index 00000000..f10d8f29 --- /dev/null +++ b/database/migrations/2018_11_17_133627_create_wikis_table.php @@ -0,0 +1,33 @@ +increments('id'); + + $table->string('domain')->unique(); + $table->string('sitename'); + + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wikis'); + } +} diff --git a/database/migrations/2019_08_14_111000_create_invitations_table.php b/database/migrations/2019_08_14_111000_create_invitations_table.php new file mode 100644 index 00000000..8cd54d83 --- /dev/null +++ b/database/migrations/2019_08_14_111000_create_invitations_table.php @@ -0,0 +1,29 @@ +increments('id'); + $table->string('code')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('invitations'); + } +} diff --git a/database/migrations/2019_08_14_155900_create_wiki_managers_table.php b/database/migrations/2019_08_14_155900_create_wiki_managers_table.php new file mode 100644 index 00000000..ccd86288 --- /dev/null +++ b/database/migrations/2019_08_14_155900_create_wiki_managers_table.php @@ -0,0 +1,31 @@ +increments('id'); + $table->integer('user_id'); + $table->integer('wiki_id'); + $table->timestamps(); + $table->unique(['user_id', 'wiki_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_managers'); + } +} diff --git a/database/migrations/2019_08_19_225500_create_user_verification_tokens_table.php b/database/migrations/2019_08_19_225500_create_user_verification_tokens_table.php new file mode 100644 index 00000000..00e35526 --- /dev/null +++ b/database/migrations/2019_08_19_225500_create_user_verification_tokens_table.php @@ -0,0 +1,30 @@ +increments('id'); + $table->integer('user_id'); + $table->string('token', 100)->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('user_verification_tokens'); + } +} diff --git a/database/migrations/2019_08_31_163057_create_failed_jobs_table.php b/database/migrations/2019_08_31_163057_create_failed_jobs_table.php new file mode 100644 index 00000000..a3302295 --- /dev/null +++ b/database/migrations/2019_08_31_163057_create_failed_jobs_table.php @@ -0,0 +1,32 @@ +bigIncrements('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('failed_jobs'); + } +} diff --git a/database/migrations/2019_09_02_000000_create_wiki_domains_table.php b/database/migrations/2019_09_02_000000_create_wiki_domains_table.php new file mode 100644 index 00000000..874b4117 --- /dev/null +++ b/database/migrations/2019_09_02_000000_create_wiki_domains_table.php @@ -0,0 +1,34 @@ +increments('id'); + + $table->string('domain')->unique(); + // The wiki_id that the domain was initially created for + // domains can not be reused.. (for now) + $table->integer('wiki_id')->nullable()->unsigned(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_domains'); + } +} diff --git a/database/migrations/2019_10_18_170700_create_queryservice_namespaces_table.php b/database/migrations/2019_10_18_170700_create_queryservice_namespaces_table.php new file mode 100644 index 00000000..2b5ac78b --- /dev/null +++ b/database/migrations/2019_10_18_170700_create_queryservice_namespaces_table.php @@ -0,0 +1,35 @@ +increments('id'); + + $table->string('namespace', 100)->unique(); + // $table->string('internalHost', 100)->unique(); + $table->string('backend', 100); + + $table->integer('wiki_id')->nullable()->unsigned()->unique(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('queryservice_namespaces'); + } +} diff --git a/database/migrations/2019_10_19_164400_create_wiki_settings_table.php b/database/migrations/2019_10_19_164400_create_wiki_settings_table.php new file mode 100644 index 00000000..2807f4f8 --- /dev/null +++ b/database/migrations/2019_10_19_164400_create_wiki_settings_table.php @@ -0,0 +1,30 @@ +increments('id'); + $table->string('name', 100); + $table->string('value', 200); + $table->integer('wiki_id')->nullable()->unsigned(); + + $table->index('wiki_id'); + $table->unique(['wiki_id', 'name']); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_settings'); + } +} diff --git a/database/migrations/2019_10_20_004100_create_event_page_updates_table.php b/database/migrations/2019_10_20_004100_create_event_page_updates_table.php new file mode 100644 index 00000000..65813872 --- /dev/null +++ b/database/migrations/2019_10_20_004100_create_event_page_updates_table.php @@ -0,0 +1,28 @@ +increments('id'); + $table->integer('wiki_id'); + // 14 allows 100 billion as an entity id.. + $table->string('title', 14); + $table->integer('namespace'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('event_page_updates'); + } +} diff --git a/database/migrations/2019_10_20_101600_create_qs_batches_table.php b/database/migrations/2019_10_20_101600_create_qs_batches_table.php new file mode 100644 index 00000000..e3c8918e --- /dev/null +++ b/database/migrations/2019_10_20_101600_create_qs_batches_table.php @@ -0,0 +1,26 @@ +increments('id'); + $table->integer('eventFrom'); + $table->integer('eventTo'); + $table->integer('wiki_id'); + $table->text('entityIds'); + $table->boolean('done'); + + $table->index('done'); + + $table->timestamps(); + }); + } + + public function down() { + Schema::dropIfExists('qs_batches'); + } +} diff --git a/database/migrations/2020_04_06_173300_create_password_resets_table.php b/database/migrations/2020_04_06_173300_create_password_resets_table.php new file mode 100644 index 00000000..5b37e246 --- /dev/null +++ b/database/migrations/2020_04_06_173300_create_password_resets_table.php @@ -0,0 +1,33 @@ +string('email')->index(); + $table->string('token')->index(); + $table->timestamp('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::drop('password_resets'); + } +} diff --git a/database/migrations/2020_12_08_192540_drop_interests_table.php b/database/migrations/2020_12_08_192540_drop_interests_table.php new file mode 100644 index 00000000..1d76ae6d --- /dev/null +++ b/database/migrations/2020_12_08_192540_drop_interests_table.php @@ -0,0 +1,14 @@ +text('value')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::table('wiki_settings', function (Blueprint $table) { + $table->string('value', 200)->change(); + }); + } +} diff --git a/database/migrations/2021_03_27_134722_modify_oauth_clients_secret_nullable.php b/database/migrations/2021_03_27_134722_modify_oauth_clients_secret_nullable.php new file mode 100644 index 00000000..a2149cc1 --- /dev/null +++ b/database/migrations/2021_03_27_134722_modify_oauth_clients_secret_nullable.php @@ -0,0 +1,23 @@ +string('secret', 100)->nullable()->change(); + }); + } + + public function down() { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->string('secret', 100)->nullable(false)->change(); + }); + } +} diff --git a/database/migrations/2021_03_27_194100_modify_oauth_clients_provider.php b/database/migrations/2021_03_27_194100_modify_oauth_clients_provider.php new file mode 100644 index 00000000..366b63a6 --- /dev/null +++ b/database/migrations/2021_03_27_194100_modify_oauth_clients_provider.php @@ -0,0 +1,28 @@ +string('provider')->after('secret')->nullable(); + }); + } + } + + public function down() { + Schema::table('oauth_clients', function ($table) { + $table->dropColumn('provider'); + }); + } +} diff --git a/database/migrations/2023_08_21_095824_create_wiki_site_stats_table.php b/database/migrations/2023_08_21_095824_create_wiki_site_stats_table.php new file mode 100644 index 00000000..d9a4998a --- /dev/null +++ b/database/migrations/2023_08_21_095824_create_wiki_site_stats_table.php @@ -0,0 +1,48 @@ +id(); + $table->timestamps(); + + $table->unsignedBigInteger('pages')->default(0); + $table->unsignedBigInteger('articles')->default(0); + $table->unsignedBigInteger('edits')->default(0); + $table->unsignedBigInteger('images')->default(0); + $table->unsignedBigInteger('users')->default(0); + $table->unsignedBigInteger('activeusers')->default(0); + $table->unsignedBigInteger('admins')->default(0); + $table->unsignedBigInteger('jobs')->default(0); + $table->unsignedBigInteger('cirrussearch-article-words')->default(0); + + $table->unsignedInteger('wiki_id'); + $table->foreign('wiki_id')->references('id')->on('wikis'); + }); + + Schema::table('wikis', function (Blueprint $table) { + $table->text('description')->nullable(); + $table->boolean('is_featured')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_site_stats'); + Schema::dropColumns('wikis', ['description', 'is_featured']); + } +} diff --git a/database/migrations/2023_08_29_145247_create_job_batches_table.php b/database/migrations/2023_08_29_145247_create_job_batches_table.php new file mode 100644 index 00000000..8b858e01 --- /dev/null +++ b/database/migrations/2023_08_29_145247_create_job_batches_table.php @@ -0,0 +1,36 @@ +string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->text('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('job_batches'); + } +} diff --git a/database/migrations/2023_09_19_094751_create_wiki_lifecycle_events_table.php b/database/migrations/2023_09_19_094751_create_wiki_lifecycle_events_table.php new file mode 100644 index 00000000..28cf70c5 --- /dev/null +++ b/database/migrations/2023_09_19_094751_create_wiki_lifecycle_events_table.php @@ -0,0 +1,33 @@ +id(); + $table->timestamps(); + $table->timestampTz('first_edited')->nullable(); + $table->timestampTz('last_edited')->nullable(); + + $table->unsignedInteger('wiki_id'); + $table->foreign('wiki_id')->references('id')->on('wikis'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_lifecycle_events'); + } +} diff --git a/database/migrations/2023_10_25_153643_qs_batches_add_pending_column.php b/database/migrations/2023_10_25_153643_qs_batches_add_pending_column.php new file mode 100644 index 00000000..b986bf1a --- /dev/null +++ b/database/migrations/2023_10_25_153643_qs_batches_add_pending_column.php @@ -0,0 +1,33 @@ +timestampTz('pending_since')->nullable()->default(null); + $table->unsignedInteger('processing_attempts')->default(0); + $table->boolean('failed')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::table('qs_batches', function (Blueprint $table) { + $table->dropColumn('pending_since'); + $table->dropColumn('processing_attempts'); + $table->dropColumn('failed'); + }); + } +} diff --git a/database/migrations/2023_10_31_204320_create_wiki_notification_sent_records_table.php b/database/migrations/2023_10_31_204320_create_wiki_notification_sent_records_table.php new file mode 100644 index 00000000..e3f87c95 --- /dev/null +++ b/database/migrations/2023_10_31_204320_create_wiki_notification_sent_records_table.php @@ -0,0 +1,35 @@ +foreign('wiki_id')->references('id')->on('wikis'); + + $table->id(); + $table->timestamps(); + + $table->integer('wiki_id')->unsigned(); + $table->integer('user_id')->unsigned(); + + $table->string('notification_type'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('wiki_notification_sent_records'); + } +} diff --git a/database/migrations/2023_11_06_084718_event_page_update_title_length.php b/database/migrations/2023_11_06_084718_event_page_update_title_length.php new file mode 100644 index 00000000..2243f8e3 --- /dev/null +++ b/database/migrations/2023_11_06_084718_event_page_update_title_length.php @@ -0,0 +1,33 @@ +text('title')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + EventPageUpdate::query()->get()->each(function (EventPageUpdate $eventPageUpdate) { + $eventPageUpdate->update(['title' => substr($eventPageUpdate->title, 0, 14)]); + }); + Schema::table('event_page_updates', function (Blueprint $table) { + $table->string('title', 14)->change(); + }); + } +} diff --git a/database/migrations/2023_11_21_091331_create_qs_checkpoints_table.php b/database/migrations/2023_11_21_091331_create_qs_checkpoints_table.php new file mode 100644 index 00000000..70b51f9a --- /dev/null +++ b/database/migrations/2023_11_21_091331_create_qs_checkpoints_table.php @@ -0,0 +1,44 @@ +integer('id')->unsigned()->primary(); + $table->integer('checkpoint')->unsigned(); + $table->timestamps(); + }); + + Schema::table('qs_batches', function (Blueprint $table) { + $table->dropColumn('eventFrom'); + $table->dropColumn('eventTo'); + }); + + QsCheckpoint::init(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + Schema::dropIfExists('qs_checkpoints'); + + Schema::table('qs_batches', function (Blueprint $table) { + $table->integer('eventFrom')->default(0); + $table->integer('eventTo')->default(0); + }); + } +} diff --git a/database/migrations/2024_04_16_165700_enforce_site_stats_constraint.php b/database/migrations/2024_04_16_165700_enforce_site_stats_constraint.php new file mode 100644 index 00000000..33e428dd --- /dev/null +++ b/database/migrations/2024_04_16_165700_enforce_site_stats_constraint.php @@ -0,0 +1,34 @@ +unique('wiki_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + // foreign key constraints need to be disabled as per https://github.com/laravel/framework/issues/13873 + Schema::disableForeignKeyConstraints(); + Schema::table('wiki_site_stats', function (Blueprint $table) { + // The column name HAS to be wrapped in an array so Laravel can + // figure out the relation name. + $table->dropUnique(['wiki_id']); + }); + Schema::enableForeignKeyConstraints(); + } +} diff --git a/database/migrations/2024_05_15_042959_add_admin_role_to_users.php b/database/migrations/2024_05_15_042959_add_admin_role_to_users.php new file mode 100644 index 00000000..f6623fbf --- /dev/null +++ b/database/migrations/2024_05_15_042959_add_admin_role_to_users.php @@ -0,0 +1,26 @@ + 0 for admins + Schema::table('users', function (Blueprint $table) { + $table->integer('is_admin')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('is_admin'); + }); + } +}; diff --git a/database/migrations/2024_05_15_043447_add_wiki_deletion_reason.php b/database/migrations/2024_05_15_043447_add_wiki_deletion_reason.php new file mode 100644 index 00000000..4a972b04 --- /dev/null +++ b/database/migrations/2024_05_15_043447_add_wiki_deletion_reason.php @@ -0,0 +1,25 @@ +string('wiki_deletion_reason')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wikis', function (Blueprint $table) { + $table->dropColumn('wiki_deletion_reason'); + }); + } +}; diff --git a/database/migrations/2024_06_19_110900_enforce_lifecycle_events_constraint.php b/database/migrations/2024_06_19_110900_enforce_lifecycle_events_constraint.php new file mode 100644 index 00000000..34f52e0c --- /dev/null +++ b/database/migrations/2024_06_19_110900_enforce_lifecycle_events_constraint.php @@ -0,0 +1,52 @@ +get(); + // Albeit `createOrUpdate` was used when creating lifecycle events + // was used, multiple copies per wiki were created. To clean up before + // enforcing a unique constraint on database level, this migration + // deletes all duplicate rows, keeping the latest one only. + foreach ($allWikis as $wiki) { + $latestLifecycleEvent = WikiLifecycleEvents::where(['wiki_id' => $wiki->id]) + ->latest() + ->take(1) + ->pluck('id'); + WikiLifecycleEvents::where(['wiki_id' => $wiki->id]) + ->whereNotIn('id', $latestLifecycleEvent) + ->delete(); + } + // Now that there is a single row per wiki, we can enforce the unique + // constraint on database level. + Schema::table('wiki_lifecycle_events', function (Blueprint $table) { + $table->unique('wiki_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() { + // foreign key constraints need to be disabled as per https://github.com/laravel/framework/issues/13873 + Schema::disableForeignKeyConstraints(); + Schema::table('wiki_lifecycle_events', function (Blueprint $table) { + // The column name HAS to be wrapped in an array so Laravel can + // figure out the relation name. + $table->dropUnique(['wiki_id']); + }); + Schema::enableForeignKeyConstraints(); + } +} diff --git a/database/migrations/2024_06_24_074114_create_wiki_entity_imports_table.php b/database/migrations/2024_06_24_074114_create_wiki_entity_imports_table.php new file mode 100644 index 00000000..0da7cfbc --- /dev/null +++ b/database/migrations/2024_06_24_074114_create_wiki_entity_imports_table.php @@ -0,0 +1,32 @@ +id(); + $table->timestamps(); + + $table->unsignedInteger('wiki_id'); + $table->foreign('wiki_id')->references('id')->on('wikis'); + + $table->enum('status', ['pending', 'failed', 'success']); + $table->timestamp('started_at')->nullable(); + $table->timestamp('finished_at')->nullable(); + $table->json('payload')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('wiki_entity_imports'); + } +}; diff --git a/database/migrations/2024_08_01_193038_remove_and_rebuild_wiki_lifecycle_events.php b/database/migrations/2024_08_01_193038_remove_and_rebuild_wiki_lifecycle_events.php new file mode 100644 index 00000000..5dd6aa52 --- /dev/null +++ b/database/migrations/2024_08_01_193038_remove_and_rebuild_wiki_lifecycle_events.php @@ -0,0 +1,22 @@ +delete(); + UpdateWikiSiteStatsJob::dispatch(); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + // + } +}; diff --git a/database/migrations/2025_01_28_144045_wiki_daily_metric.php b/database/migrations/2025_01_28_144045_wiki_daily_metric.php new file mode 100755 index 00000000..c13553f8 --- /dev/null +++ b/database/migrations/2025_01_28_144045_wiki_daily_metric.php @@ -0,0 +1,29 @@ +string('id')->primary(); + $table->string('wiki_id'); + $table->integer('pages'); + $table->boolean('is_deleted'); + $table->date('date'); + $table->timestamps(); // Created at & Updated at + $table->unique(['wiki_id', 'date']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('wiki_daily_metrics'); + } +}; diff --git a/database/migrations/2025_03_14_220054_create_wiki_profiles_table.php b/database/migrations/2025_03_14_220054_create_wiki_profiles_table.php new file mode 100644 index 00000000..0ef49e6a --- /dev/null +++ b/database/migrations/2025_03_14_220054_create_wiki_profiles_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedInteger('wiki_id'); + $table->foreign('wiki_id')->references('id')->on('wikis'); + $table->enum('purpose', ['data_hub', 'data_lab', 'tool_lab', 'test_drive', 'decide_later', 'other']); + $table->string('purpose_other')->nullable(); + $table->enum('audience', ['narrow', 'wide', 'other']); + $table->string('audience_other')->nullable(); + $table->enum('temporality', ['permanent', 'temporary', 'decide_later', 'other']); + $table->string('temporality_other')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('wiki_profiles'); + } +}; diff --git a/database/migrations/2025_03_24_143626_add_columns_to_wiki_daily_metric_table.php b/database/migrations/2025_03_24_143626_add_columns_to_wiki_daily_metric_table.php new file mode 100644 index 00000000..3f9022ca --- /dev/null +++ b/database/migrations/2025_03_24_143626_add_columns_to_wiki_daily_metric_table.php @@ -0,0 +1,26 @@ +integer('daily_actions')->nullable(); + $table->integer('weekly_actions')->nullable(); + $table->integer('monthly_actions')->nullable(); + $table->integer('quarterly_actions')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metric', function (Blueprint $table) {}); + } +}; diff --git a/database/migrations/2025_03_25_085142_wiki_profiles_audience_nullable.php b/database/migrations/2025_03_25_085142_wiki_profiles_audience_nullable.php new file mode 100644 index 00000000..374d6af1 --- /dev/null +++ b/database/migrations/2025_03_25_085142_wiki_profiles_audience_nullable.php @@ -0,0 +1,28 @@ +integer('number_of_triples')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('number_of_triples'); + }); + } +}; diff --git a/database/migrations/2025_05_19_142457_add_monthly_user_count_to_wiki_daily_metrics_table.php b/database/migrations/2025_05_19_142457_add_monthly_user_count_to_wiki_daily_metrics_table.php new file mode 100755 index 00000000..4bc7fbea --- /dev/null +++ b/database/migrations/2025_05_19_142457_add_monthly_user_count_to_wiki_daily_metrics_table.php @@ -0,0 +1,27 @@ +integer('monthly_casual_users')->nullable(); + $table->integer('monthly_active_users')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('monthly_casual_users'); + $table->dropColumn('monthly_active_users'); + }); + } +}; diff --git a/database/migrations/2025_07_18_103841_create_complaint_records_table.php b/database/migrations/2025_07_18_103841_create_complaint_records_table.php new file mode 100644 index 00000000..01a2b19e --- /dev/null +++ b/database/migrations/2025_07_18_103841_create_complaint_records_table.php @@ -0,0 +1,29 @@ +id(); + $table->timestamps(); + $table->timestamp('dispatched_at')->nullable(); + $table->string('name')->nullable(); + $table->string('mail_address')->nullable(); + $table->text('reason'); + $table->text('offending_urls'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('complaint_records'); + } +}; diff --git a/database/migrations/2025_07_30_104606_add_item_count_to_wiki_daily_merics_table.php b/database/migrations/2025_07_30_104606_add_item_count_to_wiki_daily_merics_table.php new file mode 100644 index 00000000..d81f26cf --- /dev/null +++ b/database/migrations/2025_07_30_104606_add_item_count_to_wiki_daily_merics_table.php @@ -0,0 +1,25 @@ +integer('item_count')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('item_count'); + }); + } +}; diff --git a/database/migrations/2025_07_30_104622_add_properties_count_to_wiki_daily_merics_table.php b/database/migrations/2025_07_30_104622_add_properties_count_to_wiki_daily_merics_table.php new file mode 100644 index 00000000..df1cc2dd --- /dev/null +++ b/database/migrations/2025_07_30_104622_add_properties_count_to_wiki_daily_merics_table.php @@ -0,0 +1,25 @@ +integer('property_count')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('property_count'); + }); + } +}; diff --git a/database/migrations/2025_07_30_104657_add_lexemes_count_to_wiki_daily_merics_table.php b/database/migrations/2025_07_30_104657_add_lexemes_count_to_wiki_daily_merics_table.php new file mode 100644 index 00000000..dbf01a7a --- /dev/null +++ b/database/migrations/2025_07_30_104657_add_lexemes_count_to_wiki_daily_merics_table.php @@ -0,0 +1,25 @@ +integer('lexeme_count')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('lexeme_count'); + }); + } +}; diff --git a/database/migrations/2025_07_30_104719_add_entity_schemas_count_to_wiki_daily_merics_table.php b/database/migrations/2025_07_30_104719_add_entity_schemas_count_to_wiki_daily_merics_table.php new file mode 100644 index 00000000..60180aaa --- /dev/null +++ b/database/migrations/2025_07_30_104719_add_entity_schemas_count_to_wiki_daily_merics_table.php @@ -0,0 +1,25 @@ +integer('entity_schema_count')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('entity_schema_count'); + }); + } +}; diff --git a/database/migrations/2025_09_29_194758_tou_acceptances.php b/database/migrations/2025_09_29_194758_tou_acceptances.php new file mode 100644 index 00000000..4912197e --- /dev/null +++ b/database/migrations/2025_09_29_194758_tou_acceptances.php @@ -0,0 +1,29 @@ +id(); + $table->unsignedInteger('user_id'); + $table->string('tou_version', 10); + $table->timestamp('tou_accepted_at'); + $table->timestamps(); + $table->unique(['user_id', 'tou_version']); + $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('tou_acceptances'); + } +}; diff --git a/database/migrations/2025_10_14_091126_tou_versions.php b/database/migrations/2025_10_14_091126_tou_versions.php new file mode 100644 index 00000000..a558408a --- /dev/null +++ b/database/migrations/2025_10_14_091126_tou_versions.php @@ -0,0 +1,26 @@ +id(); + $table->string('version')->unique(); + $table->boolean('active')->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('tou_versions'); + } +}; diff --git a/database/migrations/2025_12_07_204557_add_total_user_count_to_wiki_daily_metrics.php b/database/migrations/2025_12_07_204557_add_total_user_count_to_wiki_daily_metrics.php new file mode 100644 index 00000000..efddf0a4 --- /dev/null +++ b/database/migrations/2025_12_07_204557_add_total_user_count_to_wiki_daily_metrics.php @@ -0,0 +1,25 @@ +integer('total_user_count')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('wiki_daily_metrics', function (Blueprint $table) { + $table->dropColumn('total_user_count'); + }); + } +}; diff --git a/database/migrations/2026_03_06_160019_create_knowledge_equity_responses_table.php b/database/migrations/2026_03_06_160019_create_knowledge_equity_responses_table.php new file mode 100644 index 00000000..6163b4e8 --- /dev/null +++ b/database/migrations/2026_03_06_160019_create_knowledge_equity_responses_table.php @@ -0,0 +1,35 @@ +id(); + $table->timestamps(); + $table->unsignedInteger('wiki_id'); + $table + ->foreign('wiki_id') + ->references('id') + ->on('wikis') + // Explicitly use the eloquent default options. + // restrict rather than cascading chosen to not result in unexpectedly deleting Knowledge Equity Responses when we delete a wiki + ->restrictOnDelete() + ->restrictOnUpdate(); + $table->enum('selectedOption', ['yes', 'no', 'unsure', 'unsaid']); + $table->string('freeTextResponse', 3000)->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::dropIfExists('knowledge_equity_responses'); + } +};