Files
real-estate-app/database/migrations/2025_05_24_201310_create_sales_table.php
Kurtis Holsapple ee37c6de85
Some checks failed
linter / quality (push) Failing after 3m48s
tests / ci (push) Failing after 4m13s
initial commit
2025-07-12 15:01:28 -07:00

81 lines
3.9 KiB
PHP

<?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('sales', function (Blueprint $table) {
$table->increments('id');
$table->string('sale_id');
$table->string('sale_name');
$table->string('record_type');
$table->string('status');
$table->string('comp_source')->nullable();
$table->date('date_last_verified')->nullable();
$table->string('property_name')->nullable();
$table->string('comp_id')->nullable();
$table->string('street')->nullable();
$table->string('city')->nullable();
$table->string('state_province')->nullable();
$table->string('zip_postal_code')->nullable();
$table->string('property_county')->nullable();
// $table->string('market')->nullable();
// $table->string('sub_market')->nullable();
$table->foreignId("market_id")->nullable()->constrained()->nullOnDelete();
$table->foreignId("sub_market_id")->nullable()->constrained()->nullOnDelete();
$table->string('property_sub_type')->nullable();
$table->integer('num_units')->nullable();
$table->integer('building_size_sf')->nullable();
$table->integer('year_built')->nullable();
$table->date('listing_date')->nullable();
$table->integer('dom_cumulative')->nullable();
$table->integer('original_listing_price')->nullable(); // in cents
$table->integer('listing_price')->nullable(); // in cents
$table->integer('adv_agi')->nullable(); // in cents
$table->integer('x_agi')->nullable(); // in cents
$table->integer('adv_noi')->nullable(); // in cents
$table->integer('x_noi')->nullable(); // in cents
$table->integer('asking_price_unit')->nullable(); // in cents
$table->integer('asking_price_sf')->nullable(); // in cents
$table->integer('asking_grm')->nullable(); // e.g. multiply 13.08 → 1308
$table->integer('asking_cap')->nullable(); // e.g. 4.98% → 498
$table->date('can_exp_wth_date')->nullable();
$table->integer('dom_can_exp')->nullable();
$table->date('pending_date')->nullable();
$table->integer('dom_pending')->nullable();
$table->date('sale_date')->nullable();
$table->integer('dom_sold')->nullable();
$table->integer('length_of_escrow')->nullable();
$table->integer('sale_price')->nullable(); // in cents
$table->integer('sold_price_unit')->nullable(); // in cents
$table->integer('sold_price_delivered')->nullable(); // in cents
$table->integer('sold_price_sf')->nullable(); // in cents
$table->string('sales_terms')->nullable();
$table->integer('sold_grm')->nullable(); // e.g. 12.61 → 1261
$table->integer('sold_cap')->nullable(); // e.g. 5.16% → 516
$table->integer('loan_amount')->nullable(); // in cents
$table->integer('percent_down_payment')->nullable(); // e.g. 100% → 10000
$table->boolean('owner_occ_purchase')->nullable(); // 1 or 0
$table->integer('land_area_acre')->nullable(); // e.g. 0.12 → 12 (store hundredths of an acre)
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sales');
}
};