Subversion-Projekte lars-tiefland.zeldi.de_alt

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?phP

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

    return new class extends Migration
    {
        /**
         * The database connection that should be used by the migration.
         *
         * @var string
         */
        protected $connection = 'order';

        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up(): void
        {
            if ( !Schema::hasTable( 'orders' ) )
            {
                Schema::create( 'orders', function ( Blueprint $table )
                {
                    $table->id();
                    $table->foreignId( 'shop_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();
                    $table->foreignId( 'user_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
                    $table->foreignId( 'order_type_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
                    $table->foreignId( 'shipping_group_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
                    $table->foreignId( 'payment_method_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
                    $table->unsignedBigInteger( 'bill_addr_id' )->nullable()->index();
                    $table->unsignedBigInteger( 'ship_addr_id' )->nullable()->index();
                    $table->foreign( 'bill_addr_id' )->references( "id" )->on( 'order_addresses' )->cascadeOnUpdate()->nullOnDelete();
                    $table->foreign( 'ship_addr_id' )->references( "id" )->on( 'order_addresses' )->cascadeOnUpdate()->nullOnDelete();
                    $table->unsignedTinyInteger( 'paid' )->default( 0 );
                    $table->dateTime( "paid_at" )->nullable();
                    $table->text( 'paid_comment' )->nullable()->default( '' );
                    $table->string( 'foreign_id' )->default( '' );
                    $table->string( 'foreign_payment_id' )->default( '' );
                    $table->string( "status" )->default( '' );
                    $table->string( "total_amount_buffer" )->default( '' );
                    $table->text( 'item_status_buffer' )->default( '' );
                    $table->text( 'invoice_status_buffer' )->default( '' );
                    $table->text( 'delivery_note_status_buffer' )->default( '' );
                    $table->unsignedTinyInteger( 'tax' )->default( '1' );
                    $table->text( 'comment' )->default( '' );
                    $table->text( 'external_comment' )->default( '' );
                    $table->text( 'note' )->default( '' );
                    $table->text( 'additional_info' )->default( '' );
                    $table->text( 'kk_info' )->default( '' );
                    $table->string( 'created_by' )->default( '' );
                    $table->string( 'updated_by' )->default( '' );
                    $table->timestamps();
                } );
            }
        }

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