Subversion-Projekte lars-tiefland.webanos.zeldi.de

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( 'order_items' ) )
            {
                Schema::create( 'order_items', function ( Blueprint $table )
                {
                    $table->id();
                    $table->foreignId( "order_id" )->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();
                    $table->unsignedBigInteger( 'item_id' )->nullable()->index();
                    $table->unsignedBigInteger( 'child_id' )->nullable()->index();
                    $table->foreignId( 'father' )->nullable()->references( "id" )->on( 'order_items' )->cascadeOnUpdate()->nullOnDelete();
                    $table->string( "name" )->default( "" );
                    $table->float( "price" );
                    $table->unsignedInteger( "amount" );
                    $table->enum( 'status', [ '', 'offen', 'in Bearbeitung', 'reserviert', 'erledigt', 'abgeschlossen', 'freigegeben', 'versand', 'storniert', 'verborgen' ] )->default( 'offen' );
                    $table->string( "delivery_status" )->default( "" );
                    $table->enum( 'invoice_status', [ '', 'schreiben', 'geschrieben', 'bezahlt' ] )->default( '' );
                    $table->enum( 'delivery_note_status', [ '', 'schreiben', 'geschrieben', 'offen' ] )->default( '' );
                    $table->string( "foreign_id" )->default( "" );
                    $table->text( "option_input" )->default( "" );
                    $table->text( "description" )->default( "" );
                    $table->unsignedBigInteger( 'rank' )->default( '0' );
                    $table->unsignedTinyInteger( 'tax' )->default( '0' );
                    $table->float( 'orig_value' )->default( '0' );
                    $table->char( 'orig_currency', 3 )->default( '' );
                    $table->string( 'hash' )->default( '' );
                    $table->dateTime( 'exported' )->nullable();
                    $table->dateTime( 'exported_invoice' )->nullable();
                    $table->dateTime( 'exported_delivery_note' )->nullable();
                    $table->timestamps();
                } );
            }
        }

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