Coder Social home page Coder Social logo

Comments (3)

musonza avatar musonza commented on July 20, 2024 1

Hey, can you send a PR for the change? Thanks

from laravel-activity-streams.

abrahampe avatar abrahampe commented on July 20, 2024 1

I will try, I am learning to code with git yet...

from laravel-activity-streams.

abrahampe avatar abrahampe commented on July 20, 2024

It worked ok with the code below:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateActivityStreamsTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('feeds', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('feedable_type');
            $table->bigInteger('feedable_id')->unsigned();
            $table->unique(['feedable_id', 'feedable_type']);
            $table->text('extra')->nullable();
            $table->timestamps();
        });

        Schema::create('activities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('actor_type');
            $table->string('actor_id');
            $table->text('actor_data')->nullable();
            $table->string('verb');
            $table->string('object_type');
            $table->string('object_id');
            $table->text('object_data')->nullable();
            $table->string('target_type')->nullable();
            $table->string('target_id')->nullable();
            $table->text('target_data')->nullable();
            $table->timestamps();
        });

        Schema::create('feed_activities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('activity_id')->unsigned();
            $table->bigInteger('feed_id')->unsigned();
            $table->unique(['feed_id', 'activity_id']);
            $table->text('extra')->nullable();
            $table->timestamps();

            $table->foreign('activity_id')
                ->references('id')
                ->on('activities')
                ->onDelete('cascade');

            $table->foreign('feed_id')
                ->references('id')
                ->on('feeds')
                ->onDelete('cascade');
                
        });

        Schema::create('follows', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('follower_id');
            $table->string('follower_type');
            $table->string('followable_id');
            $table->string('followable_type');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('follows');
        Schema::dropIfExists('feed_activities');
        Schema::dropIfExists('activities');
        Schema::dropIfExists('feeds');
    }
}

from laravel-activity-streams.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.