summaryrefslogtreecommitdiff
path: root/ssh/database
diff options
context:
space:
mode:
authorhorus2026-06-27 05:40:45 +0200
committerhorus2026-06-27 05:40:45 +0200
commit7ff83424592cd5a3c58fe2e6d7e67aeef5144caf (patch)
treedafafa6f83c80c8bb2ee3c0b58961197a3f2a73c /ssh/database
parentb608ced142cd0527906b554e04376292f718f084 (diff)
downloadcurious-7ff83424592cd5a3c58fe2e6d7e67aeef5144caf.tar.gz
merge
Diffstat (limited to 'ssh/database')
-rw-r--r--ssh/database/.gitignore2
-rw-r--r--ssh/database/factories/UserFactory.php28
-rw-r--r--ssh/database/migrations/2014_10_12_000000_create_users_table.php36
-rw-r--r--ssh/database/migrations/2014_10_12_100000_create_password_resets_table.php32
-rw-r--r--ssh/database/migrations/2019_08_19_000000_create_failed_jobs_table.php35
-rw-r--r--ssh/database/migrations/2020_03_19_145925_create_articles_table.php34
-rw-r--r--ssh/database/migrations/2020_03_19_150116_create_discussion_table.php44
-rw-r--r--ssh/database/migrations/2020_03_19_150930_create_category_table.php33
-rw-r--r--ssh/database/migrations/2020_03_19_154610_create_code_table.php40
-rw-r--r--ssh/database/migrations/2020_03_28_131201_create_view_popular_articles.php55
-rw-r--r--ssh/database/migrations/2020_03_28_132812_create_view_articles.php53
-rw-r--r--ssh/database/migrations/2020_03_28_164915_add_excerpt_to_article.php32
-rw-r--r--ssh/database/migrations/2020_03_28_194649_join_article_category_table.php37
-rw-r--r--ssh/database/seeder/DatabaseSeeder.php18
14 files changed, 0 insertions, 479 deletions
diff --git a/ssh/database/.gitignore b/ssh/database/.gitignore
deleted file mode 100644
index 97fc976..0000000
--- a/ssh/database/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.sqlite
-*.sqlite-journal
diff --git a/ssh/database/factories/UserFactory.php b/ssh/database/factories/UserFactory.php
deleted file mode 100644
index 741edea..0000000
--- a/ssh/database/factories/UserFactory.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/** @var \Illuminate\Database\Eloquent\Factory $factory */
-
-use App\User;
-use Faker\Generator as Faker;
-use Illuminate\Support\Str;
-
-/*
-|--------------------------------------------------------------------------
-| Model Factories
-|--------------------------------------------------------------------------
-|
-| This directory should contain each of the model factory definitions for
-| your application. Factories provide a convenient way to generate new
-| model instances for testing / seeding your application's database.
-|
-*/
-
-$factory->define(User::class, function (Faker $faker) {
- return [
- 'name' => $faker->name,
- 'email' => $faker->unique()->safeEmail,
- 'email_verified_at' => now(),
- 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
- 'remember_token' => Str::random(10),
- ];
-});
diff --git a/ssh/database/migrations/2014_10_12_000000_create_users_table.php b/ssh/database/migrations/2014_10_12_000000_create_users_table.php
deleted file mode 100644
index 621a24e..0000000
--- a/ssh/database/migrations/2014_10_12_000000_create_users_table.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateUsersTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('users', function (Blueprint $table) {
- $table->id();
- $table->string('name');
- $table->string('email')->unique();
- $table->timestamp('email_verified_at')->nullable();
- $table->string('password');
- $table->rememberToken();
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('users');
- }
-}
diff --git a/ssh/database/migrations/2014_10_12_100000_create_password_resets_table.php b/ssh/database/migrations/2014_10_12_100000_create_password_resets_table.php
deleted file mode 100644
index 0ee0a36..0000000
--- a/ssh/database/migrations/2014_10_12_100000_create_password_resets_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreatePasswordResetsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('password_resets', function (Blueprint $table) {
- $table->string('email')->index();
- $table->string('token');
- $table->timestamp('created_at')->nullable();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('password_resets');
- }
-}
diff --git a/ssh/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/ssh/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
deleted file mode 100644
index 9bddee3..0000000
--- a/ssh/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateFailedJobsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('failed_jobs', function (Blueprint $table) {
- $table->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/ssh/database/migrations/2020_03_19_145925_create_articles_table.php b/ssh/database/migrations/2020_03_19_145925_create_articles_table.php
deleted file mode 100644
index f7732ac..0000000
--- a/ssh/database/migrations/2020_03_19_145925_create_articles_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateArticlesTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('article', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
-
- $table->string('url')->unique();
- $table->string('title')->default('');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('article');
- }
-}
diff --git a/ssh/database/migrations/2020_03_19_150116_create_discussion_table.php b/ssh/database/migrations/2020_03_19_150116_create_discussion_table.php
deleted file mode 100644
index 1869892..0000000
--- a/ssh/database/migrations/2020_03_19_150116_create_discussion_table.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateDiscussionTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('discussion', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
-
- $table->unsignedBigInteger('article_id')->default(0);
- $table->string('title');
- $table->string('source');
- $table->string('item_id')->unique();
- $table->string('source_url');
- $table->integer('posted_on');
- $table->integer('comments')->default(0);
- $table->integer('upvotes')->default(0);
-
- $table->foreign('article_id')->references('id')->on('article')->onDelete('cascade');
-
- $table->unique(['item_id', 'posted_on', 'source']);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('discussion');
- }
-}
diff --git a/ssh/database/migrations/2020_03_19_150930_create_category_table.php b/ssh/database/migrations/2020_03_19_150930_create_category_table.php
deleted file mode 100644
index 20905b4..0000000
--- a/ssh/database/migrations/2020_03_19_150930_create_category_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateCategoryTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('category', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
-
- $table->string('name')->unique()->default('');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('category');
- }
-}
diff --git a/ssh/database/migrations/2020_03_19_154610_create_code_table.php b/ssh/database/migrations/2020_03_19_154610_create_code_table.php
deleted file mode 100644
index e8703dd..0000000
--- a/ssh/database/migrations/2020_03_19_154610_create_code_table.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateCodeTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('code', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
-
- $table->string('url');
- $table->string('title');
- $table->string('source');
- $table->string('item_id')->unique();
- $table->string('source_url');
- $table->integer('posted_on');
- $table->integer('comments')->default(0);
- $table->integer('upvotes')->default(0);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('code');
- }
-}
diff --git a/ssh/database/migrations/2020_03_28_131201_create_view_popular_articles.php b/ssh/database/migrations/2020_03_28_131201_create_view_popular_articles.php
deleted file mode 100644
index 062b8e0..0000000
--- a/ssh/database/migrations/2020_03_28_131201_create_view_popular_articles.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\DB;
-
-class CreateViewPopularArticles extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- DB::statement("
- CREATE VIEW view_popular AS
- SELECT
- article_id as id,
- article_id,
- a.created_at,
- a.updated_at,
- a.url,
- a.title,
- a.excerpt_html,
- sum(upvotes)+sum(comments) AS impact,
- sum(upvotes) AS upvotes,
- sum(comments) as comments,
- count(article_id) AS repost
- FROM
- discussion as d
- JOIN
- article AS a ON d.article_id = a.id
- GROUP BY
- article_id,
- a.created_at,
- a.updated_at,
- a.url,
- a.title,
- a.excerpt_html
- HAVING (impact > 300) OR (count(article_id) > 2)
- ORDER BY ((sum(upvotes)+sum(comments))*count(article_id)) desc, repost desc, impact desc"
- );
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- DB::statement("DROP VIEW view_popular;");
- }
-}
diff --git a/ssh/database/migrations/2020_03_28_132812_create_view_articles.php b/ssh/database/migrations/2020_03_28_132812_create_view_articles.php
deleted file mode 100644
index 15fdee8..0000000
--- a/ssh/database/migrations/2020_03_28_132812_create_view_articles.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\DB;
-
-class CreateViewArticles extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- DB::statement(
- "CREATE VIEW view_article AS
- SELECT
- article_id as id,
- article_id,
- a.created_at,
- a.updated_at,
- a.url,
- a.title,
- a.excerpt_html,
- sum(upvotes)+sum(comments) AS impact,
- sum(upvotes) AS upvotes,
- sum(comments) as comments,
- count(article_id) AS repost
- FROM
- discussion as d
- JOIN
- article AS a ON d.article_id = a.id
- GROUP BY
- article_id,
- a.created_at,
- a.updated_at,
- a.url,
- a.title,
- a.excerpt_html"
- );
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- DB::statement("DROP VIEW view_article;");
- }
-}
diff --git a/ssh/database/migrations/2020_03_28_164915_add_excerpt_to_article.php b/ssh/database/migrations/2020_03_28_164915_add_excerpt_to_article.php
deleted file mode 100644
index c4936b9..0000000
--- a/ssh/database/migrations/2020_03_28_164915_add_excerpt_to_article.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class AddExcerptToArticle extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('article', function (Blueprint $table) {
- $table->text('excerpt_html')->nullable();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('article', function (Blueprint $table) {
- $table->dropColumn('excerpt_html');
- });
- }
-}
diff --git a/ssh/database/migrations/2020_03_28_194649_join_article_category_table.php b/ssh/database/migrations/2020_03_28_194649_join_article_category_table.php
deleted file mode 100644
index 3f843d4..0000000
--- a/ssh/database/migrations/2020_03_28_194649_join_article_category_table.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class JoinArticleCategoryTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('article_category', function (Blueprint $table) {
- $table->id();
- $table->unsignedBigInteger('article_id')->default(0);
- $table->unsignedBigInteger('category_id')->default(0);
-
- $table->foreign('article_id')->references('id')->on('article');
- $table->foreign('category_id')->references('id')->on('category');
-
- $table->unique(['article_id', 'category_id']);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('article_category');
- }
-}
diff --git a/ssh/database/seeder/DatabaseSeeder.php b/ssh/database/seeder/DatabaseSeeder.php
deleted file mode 100644
index f870c20..0000000
--- a/ssh/database/seeder/DatabaseSeeder.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Seeder;
-
-class DatabaseSeeder extends Seeder
-{
- /**
- * Seed the application's database.
- *
- * @return void
- */
- public function run()
- {
- // $this->call(UsersTableSeeder::class);
- }
-}