From 033dfd32b45224e862f32efc8c9953271d8eda44 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Fri, 15 Mar 2024 03:37:18 +1300 Subject: [PATCH] Create resolvers for categorizing columns --- src/Resolvers/BigintResolver.php | 31 +++++++++++++++++ src/Resolvers/BinaryResolver.php | 25 ++++++++++++++ src/Resolvers/BitResolver.php | 26 ++++++++++++++ src/Resolvers/BlobResolver.php | 24 +++++++++++++ src/Resolvers/BoolResolver.php | 23 +++++++++++++ src/Resolvers/BooleanResolver.php | 12 +++++++ src/Resolvers/CharResolver.php | 25 ++++++++++++++ src/Resolvers/DateResolver.php | 24 +++++++++++++ src/Resolvers/DatetimeResolver.php | 27 +++++++++++++++ src/Resolvers/DecResolver.php | 10 ++++++ src/Resolvers/DecimalResolver.php | 31 +++++++++++++++++ src/Resolvers/DoubleResolver.php | 26 ++++++++++++++ src/Resolvers/EnumResolver.php | 28 +++++++++++++++ src/Resolvers/FloatResolver.php | 34 ++++++++++++++++++ src/Resolvers/GeometryResolver.php | 22 ++++++++++++ src/Resolvers/GeometrycollectionResolver.php | 22 ++++++++++++ src/Resolvers/InetResolver.php | 23 +++++++++++++ src/Resolvers/IntResolver.php | 28 +++++++++++++++ src/Resolvers/IntegerResolver.php | 12 +++++++ src/Resolvers/JsonResolver.php | 21 ++++++++++++ src/Resolvers/JsonbResolver.php | 21 ++++++++++++ src/Resolvers/LineStringResolver.php | 22 ++++++++++++ src/Resolvers/LongblobResolver.php | 24 +++++++++++++ src/Resolvers/LongtextResolver.php | 23 +++++++++++++ src/Resolvers/MacAddressResolver.php | 21 ++++++++++++ src/Resolvers/MediumblobResolver.php | 24 +++++++++++++ src/Resolvers/MediumintResolver.php | 28 +++++++++++++++ src/Resolvers/MediumtextResolver.php | 23 +++++++++++++ src/Resolvers/MorphsResolver.php | 28 +++++++++++++++ src/Resolvers/MultipointResolver.php | 22 ++++++++++++ src/Resolvers/MultipolygonResolver.php | 22 ++++++++++++ src/Resolvers/PointResolver.php | 22 ++++++++++++ src/Resolvers/PolygonResolver.php | 22 ++++++++++++ src/Resolvers/RemembertokenResolver.php | 21 ++++++++++++ src/Resolvers/Resolver.php | 31 +++++++++++++++++ src/Resolvers/SetResolver.php | 26 ++++++++++++++ src/Resolvers/SmallintResolve.php | 28 +++++++++++++++ src/Resolvers/TextResolver.php | 23 +++++++++++++ src/Resolvers/TimeResolver.php | 26 ++++++++++++++ src/Resolvers/TimestampResolver.php | 36 ++++++++++++++++++++ src/Resolvers/TinyblobResolver.php | 24 +++++++++++++ src/Resolvers/TinyintResolver.php | 28 +++++++++++++++ src/Resolvers/TinytextResolver.php | 23 +++++++++++++ src/Resolvers/UlidResolver.php | 22 ++++++++++++ src/Resolvers/UlidmorphsResolver.php | 22 ++++++++++++ src/Resolvers/UuidResolver.php | 21 ++++++++++++ src/Resolvers/UuidmorphsResolver.php | 22 ++++++++++++ src/Resolvers/VarbinaryResolver.php | 24 +++++++++++++ src/Resolvers/VarcharResolver.php | 25 ++++++++++++++ src/Resolvers/YearResolver.php | 25 ++++++++++++++ 50 files changed, 1203 insertions(+) create mode 100644 src/Resolvers/BigintResolver.php create mode 100644 src/Resolvers/BinaryResolver.php create mode 100644 src/Resolvers/BitResolver.php create mode 100644 src/Resolvers/BlobResolver.php create mode 100644 src/Resolvers/BoolResolver.php create mode 100644 src/Resolvers/BooleanResolver.php create mode 100644 src/Resolvers/CharResolver.php create mode 100644 src/Resolvers/DateResolver.php create mode 100644 src/Resolvers/DatetimeResolver.php create mode 100644 src/Resolvers/DecResolver.php create mode 100644 src/Resolvers/DecimalResolver.php create mode 100644 src/Resolvers/DoubleResolver.php create mode 100644 src/Resolvers/EnumResolver.php create mode 100644 src/Resolvers/FloatResolver.php create mode 100644 src/Resolvers/GeometryResolver.php create mode 100644 src/Resolvers/GeometrycollectionResolver.php create mode 100644 src/Resolvers/InetResolver.php create mode 100644 src/Resolvers/IntResolver.php create mode 100644 src/Resolvers/IntegerResolver.php create mode 100644 src/Resolvers/JsonResolver.php create mode 100644 src/Resolvers/JsonbResolver.php create mode 100644 src/Resolvers/LineStringResolver.php create mode 100644 src/Resolvers/LongblobResolver.php create mode 100644 src/Resolvers/LongtextResolver.php create mode 100644 src/Resolvers/MacAddressResolver.php create mode 100644 src/Resolvers/MediumblobResolver.php create mode 100644 src/Resolvers/MediumintResolver.php create mode 100644 src/Resolvers/MediumtextResolver.php create mode 100644 src/Resolvers/MorphsResolver.php create mode 100644 src/Resolvers/MultipointResolver.php create mode 100644 src/Resolvers/MultipolygonResolver.php create mode 100644 src/Resolvers/PointResolver.php create mode 100644 src/Resolvers/PolygonResolver.php create mode 100644 src/Resolvers/RemembertokenResolver.php create mode 100644 src/Resolvers/Resolver.php create mode 100644 src/Resolvers/SetResolver.php create mode 100644 src/Resolvers/SmallintResolve.php create mode 100644 src/Resolvers/TextResolver.php create mode 100644 src/Resolvers/TimeResolver.php create mode 100644 src/Resolvers/TimestampResolver.php create mode 100644 src/Resolvers/TinyblobResolver.php create mode 100644 src/Resolvers/TinyintResolver.php create mode 100644 src/Resolvers/TinytextResolver.php create mode 100644 src/Resolvers/UlidResolver.php create mode 100644 src/Resolvers/UlidmorphsResolver.php create mode 100644 src/Resolvers/UuidResolver.php create mode 100644 src/Resolvers/UuidmorphsResolver.php create mode 100644 src/Resolvers/VarbinaryResolver.php create mode 100644 src/Resolvers/VarcharResolver.php create mode 100644 src/Resolvers/YearResolver.php diff --git a/src/Resolvers/BigintResolver.php b/src/Resolvers/BigintResolver.php new file mode 100644 index 0000000..986fb20 --- /dev/null +++ b/src/Resolvers/BigintResolver.php @@ -0,0 +1,31 @@ +column->field.'\' => fake()->numerify(),'; + } + + public function migration(): string + { + // TODO: bigIncrements() + // TODO: $table->foreignId('user_id'); + // TODO: $table->foreignIdFor(User::class); + // TODO: $table->id(); + // TODO: $table->unsignedBigInteger('votes'); + $migration = '$table->bigInteger(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/BinaryResolver.php b/src/Resolvers/BinaryResolver.php new file mode 100644 index 0000000..1318bd3 --- /dev/null +++ b/src/Resolvers/BinaryResolver.php @@ -0,0 +1,25 @@ +column->field.'\' => fake()->sha1(),'; + } + + public function migration(): string + { + $migration = '$table->binary(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/BitResolver.php b/src/Resolvers/BitResolver.php new file mode 100644 index 0000000..327acab --- /dev/null +++ b/src/Resolvers/BitResolver.php @@ -0,0 +1,26 @@ +column->field.'\' => fake()->numberBetween(1, 64),'; + } + + public function migration(): string + { + $migration = '$table->integer(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/BlobResolver.php b/src/Resolvers/BlobResolver.php new file mode 100644 index 0000000..647354e --- /dev/null +++ b/src/Resolvers/BlobResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->sha1(),'; + } + + public function migration(): string + { + $migration = '$table->binary(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/BoolResolver.php b/src/Resolvers/BoolResolver.php new file mode 100644 index 0000000..8d6e464 --- /dev/null +++ b/src/Resolvers/BoolResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->boolean(),'; + } + + public function migration(): string + { + $migration = '$table->boolean(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/BooleanResolver.php b/src/Resolvers/BooleanResolver.php new file mode 100644 index 0000000..b4dd1a8 --- /dev/null +++ b/src/Resolvers/BooleanResolver.php @@ -0,0 +1,12 @@ +column->field.'\' => fake()->randomLetter(),'; + } + + public function migration(): string + { + $migration = '$table->char(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/DateResolver.php b/src/Resolvers/DateResolver.php new file mode 100644 index 0000000..e20a7e6 --- /dev/null +++ b/src/Resolvers/DateResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->date(),'; + } + + public function migration(): string + { + $migration = '$table->date(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/DatetimeResolver.php b/src/Resolvers/DatetimeResolver.php new file mode 100644 index 0000000..b36c1e7 --- /dev/null +++ b/src/Resolvers/DatetimeResolver.php @@ -0,0 +1,27 @@ +column->field.'\' => fake()->dateTime(),'; + } + + public function migration(): string + { + // TODO: dateTimeTz + $migration = '$table->dateTime(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/DecResolver.php b/src/Resolvers/DecResolver.php new file mode 100644 index 0000000..8891105 --- /dev/null +++ b/src/Resolvers/DecResolver.php @@ -0,0 +1,10 @@ +column->field.'\' => fake()->randomFloat(2, 0, 10000),'; + } + + public function migration(): string + { + // TODO: $table->decimal('amount', $precision = 8, $scale = 2); + // TODO: $table->unsignedDecimal('amount', $precision = 8, $scale = 2); + $migration = '$table->decimal(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/DoubleResolver.php b/src/Resolvers/DoubleResolver.php new file mode 100644 index 0000000..04b0e7e --- /dev/null +++ b/src/Resolvers/DoubleResolver.php @@ -0,0 +1,26 @@ +column->field.'\' => fake()->randomFloat(),'; + } + + public function migration(): string + { + // TODO: $table->double('amount', 8, 2); + $migration = '$table->double(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/EnumResolver.php b/src/Resolvers/EnumResolver.php new file mode 100644 index 0000000..9c49395 --- /dev/null +++ b/src/Resolvers/EnumResolver.php @@ -0,0 +1,28 @@ +column->field.'\' => fake()->randomElements(1,2,3),'; + } + + public function migration(): string + { + // TODO: $table->enum('difficulty', ['easy', 'hard']); + $migration = '$table->enum(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/FloatResolver.php b/src/Resolvers/FloatResolver.php new file mode 100644 index 0000000..2a8e997 --- /dev/null +++ b/src/Resolvers/FloatResolver.php @@ -0,0 +1,34 @@ +column->field.'\' => fake()->randomFloat(),'; + } + + public function migration(): string + { + // TODO: $table->float('amount', 8, 2); + $migration = '$table->float(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/GeometryResolver.php b/src/Resolvers/GeometryResolver.php new file mode 100644 index 0000000..0aaa99c --- /dev/null +++ b/src/Resolvers/GeometryResolver.php @@ -0,0 +1,22 @@ +column->field.'\' => fake()->numerify(),'; + } + + public function migration(): string + { + $migration = '$table->geometry(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/GeometrycollectionResolver.php b/src/Resolvers/GeometrycollectionResolver.php new file mode 100644 index 0000000..84f8637 --- /dev/null +++ b/src/Resolvers/GeometrycollectionResolver.php @@ -0,0 +1,22 @@ +column->field.'\' => fake()->numerify(),'; + } + + public function migration(): string + { + $migration = '$table->geometryCollection(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/InetResolver.php b/src/Resolvers/InetResolver.php new file mode 100644 index 0000000..953dd42 --- /dev/null +++ b/src/Resolvers/InetResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->localIpv4(),'; + } + + public function migration(): string + { + $migration = '$table->ipAddress(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/IntResolver.php b/src/Resolvers/IntResolver.php new file mode 100644 index 0000000..f7fd9b4 --- /dev/null +++ b/src/Resolvers/IntResolver.php @@ -0,0 +1,28 @@ +column->field.'\' => fake()->randomNumber(),'; + } + + public function migration(): string + { + // TODO: $table->increments('id'); + // TODO: $table->unsignedInteger('votes'); + $migration = '$table->integer(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/IntegerResolver.php b/src/Resolvers/IntegerResolver.php new file mode 100644 index 0000000..92653b7 --- /dev/null +++ b/src/Resolvers/IntegerResolver.php @@ -0,0 +1,12 @@ +column->field.'\' => json_encode(fake()->words()),'; + } + + public function migration(): string + { + $migration = '$table->json(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/JsonbResolver.php b/src/Resolvers/JsonbResolver.php new file mode 100644 index 0000000..94d87a0 --- /dev/null +++ b/src/Resolvers/JsonbResolver.php @@ -0,0 +1,21 @@ +column->field.'\' => json_encode(fake()->words()),'; + } + + public function migration(): string + { + $migration = '$table->jsonb(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/LineStringResolver.php b/src/Resolvers/LineStringResolver.php new file mode 100644 index 0000000..929c0da --- /dev/null +++ b/src/Resolvers/LineStringResolver.php @@ -0,0 +1,22 @@ +column->field.'\' => fake()->numerify(),'; + } + + public function migration(): string + { + $migration = '$table->lineString(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/LongblobResolver.php b/src/Resolvers/LongblobResolver.php new file mode 100644 index 0000000..07a0ead --- /dev/null +++ b/src/Resolvers/LongblobResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->sentence(),'; + } + + public function migration(): string + { + $migration = '$table->text(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/LongtextResolver.php b/src/Resolvers/LongtextResolver.php new file mode 100644 index 0000000..2884ad4 --- /dev/null +++ b/src/Resolvers/LongtextResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->paragraph(),'; + } + + public function migration(): string + { + $migration = '$table->longText(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MacAddressResolver.php b/src/Resolvers/MacAddressResolver.php new file mode 100644 index 0000000..ed84aab --- /dev/null +++ b/src/Resolvers/MacAddressResolver.php @@ -0,0 +1,21 @@ +column->field.'\' => fake()->macAddress(),'; + } + + public function migration(): string + { + $migration = '$table->macAddress(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MediumblobResolver.php b/src/Resolvers/MediumblobResolver.php new file mode 100644 index 0000000..76d11b2 --- /dev/null +++ b/src/Resolvers/MediumblobResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->paragraph(),'; + } + + public function migration(): string + { + $migration = '$table->text(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MediumintResolver.php b/src/Resolvers/MediumintResolver.php new file mode 100644 index 0000000..19e7bf5 --- /dev/null +++ b/src/Resolvers/MediumintResolver.php @@ -0,0 +1,28 @@ +column->field.'\' => fake()->randomNumber(),'; + } + + public function migration(): string + { + // TODO: $table->mediumIncrements('id'); + // TODO: $table->unsignedMediumInteger('votes'); + $migration = '$table->mediumInteger(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MediumtextResolver.php b/src/Resolvers/MediumtextResolver.php new file mode 100644 index 0000000..f9c9a72 --- /dev/null +++ b/src/Resolvers/MediumtextResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->paragraph(),'; + } + + public function migration(): string + { + $migration = '$table->mediumText(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MorphsResolver.php b/src/Resolvers/MorphsResolver.php new file mode 100644 index 0000000..5de3768 --- /dev/null +++ b/src/Resolvers/MorphsResolver.php @@ -0,0 +1,28 @@ +nullableMorphs('taggable'); + $migration = '$table->morphs(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MultipointResolver.php b/src/Resolvers/MultipointResolver.php new file mode 100644 index 0000000..89553c0 --- /dev/null +++ b/src/Resolvers/MultipointResolver.php @@ -0,0 +1,22 @@ +multiPoint(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/MultipolygonResolver.php b/src/Resolvers/MultipolygonResolver.php new file mode 100644 index 0000000..9be1e4f --- /dev/null +++ b/src/Resolvers/MultipolygonResolver.php @@ -0,0 +1,22 @@ +multiPolygon(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/PointResolver.php b/src/Resolvers/PointResolver.php new file mode 100644 index 0000000..cd1a96e --- /dev/null +++ b/src/Resolvers/PointResolver.php @@ -0,0 +1,22 @@ +point(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/PolygonResolver.php b/src/Resolvers/PolygonResolver.php new file mode 100644 index 0000000..2af4f45 --- /dev/null +++ b/src/Resolvers/PolygonResolver.php @@ -0,0 +1,22 @@ +polygon(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/RemembertokenResolver.php b/src/Resolvers/RemembertokenResolver.php new file mode 100644 index 0000000..3a2f05a --- /dev/null +++ b/src/Resolvers/RemembertokenResolver.php @@ -0,0 +1,21 @@ +column->field.'\' => fake()->sha256(),'; + } + + public function migration(): string + { + $migration = '$table->rememberToken()'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/Resolver.php b/src/Resolvers/Resolver.php new file mode 100644 index 0000000..1a0b023 --- /dev/null +++ b/src/Resolvers/Resolver.php @@ -0,0 +1,31 @@ +column->nullable) { + $migration .= '->nullable()'; + } + + if (! is_null($this->column->default)) { + $migration .= '->default("'.$this->column->default.'")'; + } + + return $migration.';'; + } +} diff --git a/src/Resolvers/SetResolver.php b/src/Resolvers/SetResolver.php new file mode 100644 index 0000000..6d4776c --- /dev/null +++ b/src/Resolvers/SetResolver.php @@ -0,0 +1,26 @@ +column->field.'\' => fake()->randomElement([1,2,3]),'; + } + + public function migration(): string + { + // TODO: $table->set('flavors', ['strawberry', 'vanilla']); + $migration = '$table->set(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/SmallintResolve.php b/src/Resolvers/SmallintResolve.php new file mode 100644 index 0000000..0012342 --- /dev/null +++ b/src/Resolvers/SmallintResolve.php @@ -0,0 +1,28 @@ +column->field.'\' => fake()->numberBetween(0, 32767),'; + } + + public function migration(): string + { + // TODO: $table->smallIncrements('id'); + // TODO: $table->unsignedSmallInteger('votes'); + $migration = '$table->smallInteger(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TextResolver.php b/src/Resolvers/TextResolver.php new file mode 100644 index 0000000..ecd4eca --- /dev/null +++ b/src/Resolvers/TextResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->paragraph(),'; + } + + public function migration(): string + { + $migration = '$table->text(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TimeResolver.php b/src/Resolvers/TimeResolver.php new file mode 100644 index 0000000..2f97628 --- /dev/null +++ b/src/Resolvers/TimeResolver.php @@ -0,0 +1,26 @@ +column->field.'\' => fake()->time(),'; + } + + public function migration(): string + { + // TODO: $table->timeTz('sunrise', $precision = 0); + $migration = '$table->time(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TimestampResolver.php b/src/Resolvers/TimestampResolver.php new file mode 100644 index 0000000..7e283e4 --- /dev/null +++ b/src/Resolvers/TimestampResolver.php @@ -0,0 +1,36 @@ +column->field.'\' => fake()->unixTime(),'; + } + + public function migration(): string + { + // TODO: $table->nullableTimestamps(0); + // The nullableTimestamps method is an alias of the timestamps method: + // @see https://laravel.com/docs/10.x/migrations#column-method-nullableTimestamps + // + // TODO: $table->softDeletesTz($column = 'deleted_at', $precision = 0); + // TODO: $table->softDeletes($column = 'deleted_at', $precision = 0); + // TODO: $table->timestampTz('added_at', $precision = 0); + // TODO: $table->timestampsTz($precision = 0); + // TODO: $table->timestamps($precision = 0); + $migration = '$table->timestamp(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TinyblobResolver.php b/src/Resolvers/TinyblobResolver.php new file mode 100644 index 0000000..053f753 --- /dev/null +++ b/src/Resolvers/TinyblobResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->randomLetter(),'; + } + + public function migration(): string + { + $migration = '$table->integer(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TinyintResolver.php b/src/Resolvers/TinyintResolver.php new file mode 100644 index 0000000..09da905 --- /dev/null +++ b/src/Resolvers/TinyintResolver.php @@ -0,0 +1,28 @@ +column->field.'\' => fake()->numberBetween(0, 127),'; + } + + public function migration(): string + { + // TODO: $table->tinyIncrements('id'); + // TODO: $table->unsignedTinyInteger('votes'); + $migration = '$table->tinyInteger(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/TinytextResolver.php b/src/Resolvers/TinytextResolver.php new file mode 100644 index 0000000..f27ce80 --- /dev/null +++ b/src/Resolvers/TinytextResolver.php @@ -0,0 +1,23 @@ +column->field.'\' => fake()->sentence(),'; + } + + public function migration(): string + { + $migration = '$table->tinyText(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/UlidResolver.php b/src/Resolvers/UlidResolver.php new file mode 100644 index 0000000..2a3bf3a --- /dev/null +++ b/src/Resolvers/UlidResolver.php @@ -0,0 +1,22 @@ +ulid(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/UlidmorphsResolver.php b/src/Resolvers/UlidmorphsResolver.php new file mode 100644 index 0000000..a22677c --- /dev/null +++ b/src/Resolvers/UlidmorphsResolver.php @@ -0,0 +1,22 @@ +ulidMorphs(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/UuidResolver.php b/src/Resolvers/UuidResolver.php new file mode 100644 index 0000000..50ced89 --- /dev/null +++ b/src/Resolvers/UuidResolver.php @@ -0,0 +1,21 @@ +column->field.'\' => fake()->uuid(),'; + } + + public function migration(): string + { + $migration = '$table->uuid(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/UuidmorphsResolver.php b/src/Resolvers/UuidmorphsResolver.php new file mode 100644 index 0000000..8baa3bd --- /dev/null +++ b/src/Resolvers/UuidmorphsResolver.php @@ -0,0 +1,22 @@ +uuidMorphs(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/VarbinaryResolver.php b/src/Resolvers/VarbinaryResolver.php new file mode 100644 index 0000000..09460b5 --- /dev/null +++ b/src/Resolvers/VarbinaryResolver.php @@ -0,0 +1,24 @@ +column->field.'\' => fake()->sentence(),'; + } + + public function migration(): string + { + $migration = '$table->char(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/VarcharResolver.php b/src/Resolvers/VarcharResolver.php new file mode 100644 index 0000000..c8b0da2 --- /dev/null +++ b/src/Resolvers/VarcharResolver.php @@ -0,0 +1,25 @@ +column->field.'\' => fake()->paragraph(),'; + } + + public function migration(): string + { + // TODO: $table->ipAddress('visitor'); + $migration = '$table->string(\''.$this->column->field.'\')'; + + return $this->last($migration); + } +} diff --git a/src/Resolvers/YearResolver.php b/src/Resolvers/YearResolver.php new file mode 100644 index 0000000..59b970f --- /dev/null +++ b/src/Resolvers/YearResolver.php @@ -0,0 +1,25 @@ +column->field.'\' => fake()->year(),'; + } + + public function migration(): string + { + $migration = '$table->year(\''.$this->column->field.'\', '.$this->column->bracket.')'; + + return $this->last($migration); + } +}