Tablas simplificadas
This commit is contained in:
parent
fc367c05a3
commit
f8b487cebd
4 changed files with 161 additions and 0 deletions
45
database/migrations/2025_05_15_033316_simplificar_users.php
Normal file
45
database/migrations/2025_05_15_033316_simplificar_users.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
use App\User;
|
||||
use App\UserRole;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SimplificarUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['is_admin', 'is_compras']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('is_admin')->default(false);
|
||||
$table->boolean('is_compras')->default(false);
|
||||
});
|
||||
|
||||
$admin_barrio = UserRole::where('nombre', 'admin_barrio')->first();
|
||||
$comision = UserRole::where('nombre', 'comision')->first();
|
||||
foreach (User::all() as $user) {
|
||||
if ($user->role_id == $admin_barrio->id)
|
||||
$user->is_admin = true;
|
||||
if ($user->role_id == $comision->id)
|
||||
$user->is_compras = true;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SimplificarBarrios extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('grupos_de_compra', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'cantidad_de_nucleos',
|
||||
'telefono',
|
||||
'correo',
|
||||
'referente_finanzas',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('grupos_de_compra', function (Blueprint $table) {
|
||||
$table->double('cantidad_de_nucleos');
|
||||
$table->string('telefono');
|
||||
$table->string('correo');
|
||||
$table->string('referente_finanzas');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SimplificarProductos extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'presentacion',
|
||||
'stock',
|
||||
'imagen_id',
|
||||
'descripcion',
|
||||
'apto_veganxs',
|
||||
'apto_celiacxs',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
$table->integer('presentacion')->nullable();
|
||||
$table->integer('stock')->nullable();
|
||||
$table->foreignId('imagen_id')->nullable();
|
||||
$table->string('descripcion')->nullable();
|
||||
$table->boolean('apto_veganxs')->nullable();
|
||||
$table->boolean('apto_celiacxs')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SimplificarProductoSubpedido extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('producto_subpedido', function (Blueprint $table) {
|
||||
$table->dropColumn('total');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('producto_subpedido', function (Blueprint $table) {
|
||||
$table->double('total');
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue