This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('conecta_cidadao_sms_codes', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('cidadao_id');
|
||||
$table->string('telefone', 20);
|
||||
$table->string('codigo', 10);
|
||||
$table->timestamp('expires_at');
|
||||
$table->timestamp('last_sent_at')->nullable();
|
||||
$table->unsignedTinyInteger('tentativas_envio')->default(0);
|
||||
$table->unsignedTinyInteger('tentativas_validacao')->default(0);
|
||||
$table->boolean('usado')->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
$table
|
||||
->foreign('cidadao_id')
|
||||
->references('id')
|
||||
->on('cadastro_cidadao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('conecta_cidadao_sms_codes');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateConectaCidadaoAvaliacaoAtendimentoTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('conecta_cidadao_avaliacao_atendimento', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('pronto_atendimento_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('pronto_atendimento_atendimento');
|
||||
|
||||
$table->foreignId('ambulatorio_atendimento_pre_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento');
|
||||
|
||||
$table->foreignId('ambulatorio_atendimento_soap_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_soap');
|
||||
|
||||
$table->foreignId('ambulatorio_atendimento_pos_consulta_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pos_consulta');
|
||||
|
||||
$table->unsignedTinyInteger('nota')->nullable();
|
||||
$table->string('comentario', 100)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('conecta_cidadao_avaliacao_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('conecta_cidadao_termo_tipo', function (Blueprint $table) {
|
||||
|
||||
$table
|
||||
->id();
|
||||
|
||||
$table
|
||||
->string('codigo', 50)
|
||||
->unique()
|
||||
->comment('Código identificador do tipo (ex: TERMO_USO).');
|
||||
|
||||
$table
|
||||
->string('nome', 100)
|
||||
->comment('Nome legível do tipo de termo.');
|
||||
|
||||
$table
|
||||
->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('conecta_cidadao_termo_tipo');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('conecta_cidadao_termo', function (Blueprint $table) {
|
||||
|
||||
$table
|
||||
->id();
|
||||
|
||||
$table
|
||||
->foreignId('tipo_id')
|
||||
->constrained('conecta_cidadao_termo_tipo')
|
||||
->comment('Tipo do termo.');
|
||||
|
||||
$table
|
||||
->string('versao', 20)
|
||||
->comment('Versão do documento.');
|
||||
|
||||
$table
|
||||
->longText('conteudo');
|
||||
|
||||
$table
|
||||
->date('data_publicacao');
|
||||
|
||||
$table
|
||||
->boolean('obrigatorio')
|
||||
->default(true)
|
||||
->comment('Indica se o aceite desta versão é obrigatório para o login.');
|
||||
|
||||
$table
|
||||
->boolean('ativo')
|
||||
->default(true)
|
||||
->comment('Indica se esta versão do termo está ativa e em vigor.');
|
||||
|
||||
$table
|
||||
->unique(
|
||||
[
|
||||
'tipo_id',
|
||||
'versao'
|
||||
]
|
||||
);
|
||||
|
||||
$table
|
||||
->index(
|
||||
[
|
||||
'tipo_id',
|
||||
'ativo'
|
||||
]
|
||||
);
|
||||
|
||||
$table
|
||||
->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('conecta_cidadao_termo');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('conecta_cidadao_aceitacao_cidadao', function (Blueprint $table) {
|
||||
|
||||
$table
|
||||
->id();
|
||||
|
||||
$table
|
||||
->foreignId('cidadao_id')
|
||||
->constrained('cadastro_cidadao');
|
||||
|
||||
$table
|
||||
->foreignId('termo_id')
|
||||
->constrained('conecta_cidadao_termo');
|
||||
|
||||
$table
|
||||
->timestamp('aceitado_em')
|
||||
->useCurrent();
|
||||
|
||||
$table
|
||||
->unique(
|
||||
[
|
||||
'cidadao_id',
|
||||
'termo_id'
|
||||
]
|
||||
);
|
||||
|
||||
$table
|
||||
->index('cidadao_id');
|
||||
|
||||
$table
|
||||
->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('conecta_cidadao_aceitacao_cidadao');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user