init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroLogradouroTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_logradouro_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('descricao', 25);
$table->char('codigo', 3)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_logradouro_tipo');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroBairroTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_bairro', function (Blueprint $table) {
$table->id();
$table->string('nome', 180);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['nome', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_bairro');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroLogradouroTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_logradouro', function (Blueprint $table) {
$table->id();
$table->foreignId('municipio_id')->constrained('intranet.cadastro_municipio');
$table->foreignId('bairro_id')->constrained('cadastro_bairro');
$table->foreignId('tipo_id')->constrained('cadastro_logradouro_tipo');
$table->string('nome', 255);
$table->char('cep', 8)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['municipio_id', 'bairro_id', 'tipo_id', 'nome', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_logradouro');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroLoteamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_loteamento', function (Blueprint $table) {
$table->id();
$table->string('nome', 80);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['nome', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_loteamento');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroZonaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_zona', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('descricao', 10);
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_zona');
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroEnderecoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_endereco', function (Blueprint $table) {
$table->id();
$table->foreignId('logradouro_id')->constrained('cadastro_logradouro');
$table->unsignedInteger('numero')->nullable();
$table->string('complemento', 180)->nullable();
$table->string('latitude', 10)->nullable();
$table->string('longitude', 10)->nullable();
$table->string('referencia', 150)->nullable();
$table->foreignId('zona_id')->nullable()->constrained('cadastro_zona');
$table->foreignId('loteamento_id')->nullable()->constrained('cadastro_loteamento');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['logradouro_id', 'numero', 'complemento', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_endereco');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroDomicilioTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_domicilio', function (Blueprint $table) {
$table->id();
$table->foreignId('endereco_id')->constrained('cadastro_endereco');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['endereco_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_domicilio');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterZonaIdToNotNullOnCadastroEndereco extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_endereco', function (Blueprint $table) {
$table->foreignId('zona_id')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_endereco', function (Blueprint $table) {
$table->foreignId('zona_id')->nullable(true)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetZonaIdToNullableOnCadastroEndereco extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_endereco', function (Blueprint $table) {
$table->unsignedBigInteger('zona_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_endereco', function (Blueprint $table) {
$table->unsignedBigInteger('zona_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeNomeOnCadastroLogradouro extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_logradouro', function (Blueprint $table) {
$table->string('nome', 250)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_logradouro', function (Blueprint $table) {
$table->string('nome', 255)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeNomeOnCadastroLoteamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_loteamento', function (Blueprint $table) {
$table->string('nome', 100)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_loteamento', function (Blueprint $table) {
$table->string('nome', 80)->change();
});
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetCodigoToNullableOnCadastroLogradouroTipo extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_logradouro_tipo', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->char('codigo', 3)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_logradouro_tipo', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->char('codigo', 3)->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeDescricaoOnCadastroLogradouroTipo extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_logradouro_tipo', function (Blueprint $table) {
$table->string('descricao', 30)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_logradouro_tipo', function (Blueprint $table) {
$table->string('descricao', 25)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoEsusToCadastroZonaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_zona', function (Blueprint $table) {
$table->smallInteger('codigo_esus')->nullable()->after('descricao')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_zona', function (Blueprint $table) {
$table->dropColumn(['codigo_esus']);
});
}
}