añadida migracion y modelo, entidad y controlador basicos

This commit is contained in:
2025-02-24 09:59:35 +01:00
parent c5f1f0e55a
commit c1cae0fcf7
5 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,107 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use function PHPSTORM_META\type;
class CreateServiciosAcabadoTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'tarifa_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'nombre' =>[
'type' => 'VARCHAR',
'constraint' => 100,
'unique' => true
],
'comentarios' => [
'type' => 'TEXT',
'null' => true,
],
'user_updated_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
'deleted_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('user_updated_id', 'users', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('servicios_acabado');
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'tarifa_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'servicio_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'user_updated_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
'deleted_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('servicio_id', 'servicios_acabado', 'id', 'NO_ACTION', 'NO_ACTION');
$this->forge->addForeignKey('tarifa_id', 'lg_tarifa_acabado', 'id', 'NO_ACTION', 'NO_ACTION');
$this->forge->addForeignKey('user_updated_id', 'users', 'id', 'NO_ACTION', 'NO_ACTION');
$this->forge->createTable('tarifasAcabado_serviciosAcabado');
}
public function down()
{
$this->forge->dropTable('servicios_acabado');
$this->forge->dropTable('tarifasAcabado_serviciosAcabado');
}
}