diff --git a/app/Models/Expanse.php b/app/Models/Expanse.php new file mode 100644 index 00000000..04d0eac7 --- /dev/null +++ b/app/Models/Expanse.php @@ -0,0 +1,11 @@ +string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); - $table->rememberToken(); + $table->string('role')->default('user'); + $table->double('account')->default(0); $table->timestamps(); }); } diff --git a/database/migrations/2023_12_29_153012_create_histories_table.php b/database/migrations/2023_12_29_153012_create_histories_table.php new file mode 100644 index 00000000..7ea5b88c --- /dev/null +++ b/database/migrations/2023_12_29_153012_create_histories_table.php @@ -0,0 +1,33 @@ +unsignedInteger('year'); + $table->unsignedInteger('month'); + $table->unsignedBigInteger('id_user'); + $table->double('amount'); + + $table->foreign('id_user') + ->references('id')->on('users'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('histories'); + } +}; diff --git a/database/migrations/2023_12_29_153303_create_type_expanses_table.php b/database/migrations/2023_12_29_153303_create_type_expanses_table.php new file mode 100644 index 00000000..79a938c8 --- /dev/null +++ b/database/migrations/2023_12_29_153303_create_type_expanses_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('label'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('type_expanses'); + } +}; diff --git a/database/migrations/2023_12_29_153611_create_recurrings_table.php b/database/migrations/2023_12_29_153611_create_recurrings_table.php new file mode 100644 index 00000000..f941695f --- /dev/null +++ b/database/migrations/2023_12_29_153611_create_recurrings_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('label'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('recurrings'); + } +}; diff --git a/database/migrations/2023_12_29_153723_create_type_incomes_table.php b/database/migrations/2023_12_29_153723_create_type_incomes_table.php new file mode 100644 index 00000000..82010a71 --- /dev/null +++ b/database/migrations/2023_12_29_153723_create_type_incomes_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('label'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('type_incomes'); + } +}; diff --git a/database/migrations/2023_12_29_153818_create_previsional_expanses_table.php b/database/migrations/2023_12_29_153818_create_previsional_expanses_table.php new file mode 100644 index 00000000..ce911ba9 --- /dev/null +++ b/database/migrations/2023_12_29_153818_create_previsional_expanses_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('id_user'); + $table->unsignedBigInteger('id_type_expanse'); + $table->double('amount')->default(0); + $table->string('description', 200)->default(''); + $table->date('date'); + + $table->foreign('id_user') + ->references('id')->on('users'); + $table->foreign('id_type_expanse') + ->references('id')->on('type_expanses'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('previsional_expanses'); + } +}; diff --git a/database/migrations/2023_12_29_154340_create_expanses_table.php b/database/migrations/2023_12_29_154340_create_expanses_table.php new file mode 100644 index 00000000..16582476 --- /dev/null +++ b/database/migrations/2023_12_29_154340_create_expanses_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('id_user'); + $table->unsignedBigInteger('id_type_expanse'); + $table->double('amount')->default(0); + $table->string('description', 200)->default(''); + $table->date('date'); + + $table->foreign('id_user') + ->references('id')->on('users'); + $table->foreign('id_type_expanse') + ->references('id')->on('type_expanses'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('expanses'); + } +}; diff --git a/database/migrations/2023_12_29_154521_create_recurring_expenses_table.php b/database/migrations/2023_12_29_154521_create_recurring_expenses_table.php new file mode 100644 index 00000000..cc5ee509 --- /dev/null +++ b/database/migrations/2023_12_29_154521_create_recurring_expenses_table.php @@ -0,0 +1,41 @@ +id(); + $table->unsignedBigInteger('id_type_expanse'); + $table->unsignedBigInteger('id_recurring'); + $table->unsignedBigInteger('id_user'); + $table->double('amount')->default(0); + $table->string('description', 200)->default(''); + $table->date('date'); + $table->date('end_date')->nullable(); + + $table->foreign('id_type_expanse') + ->references('id')->on('type_expanses'); + $table->foreign('id_recurring') + ->references('id')->on('recurrings'); + $table->foreign('id_user') + ->references('id')->on('users'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('recurring_expenses'); + } +}; diff --git a/database/migrations/2023_12_29_160137_create_recurring_incomes_table.php b/database/migrations/2023_12_29_160137_create_recurring_incomes_table.php new file mode 100644 index 00000000..71986681 --- /dev/null +++ b/database/migrations/2023_12_29_160137_create_recurring_incomes_table.php @@ -0,0 +1,41 @@ +id(); + $table->unsignedBigInteger('id_type_expanse'); + $table->unsignedBigInteger('id_recurring'); + $table->unsignedBigInteger('id_user'); + $table->double('amount')->default(0); + $table->string('description', 200)->default(''); + $table->date('date'); + $table->date('end_date')->nullable(); + + $table->foreign('id_type_expanse') + ->references('id')->on('type_expanses'); + $table->foreign('id_recurring') + ->references('id')->on('recurrings'); + $table->foreign('id_user') + ->references('id')->on('users'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('recurring_incomes'); + } +}; diff --git a/database/migrations/2023_12_29_160431_create_incomes_table.php b/database/migrations/2023_12_29_160431_create_incomes_table.php new file mode 100644 index 00000000..de657c88 --- /dev/null +++ b/database/migrations/2023_12_29_160431_create_incomes_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('id_user'); + $table->unsignedBigInteger('id_type_income'); + $table->double('amount'); + $table->string('description', 200)->default(''); + $table->date('date'); + + $table->foreign('id_user') + ->references('id')->on('users'); + $table->foreign('id_type_income') + ->references('id')->on('type_incomes'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('incomes'); + } +}; diff --git a/database/migrations/2023_12_29_160709_create_previsional_incomes_table.php b/database/migrations/2023_12_29_160709_create_previsional_incomes_table.php new file mode 100644 index 00000000..05b92749 --- /dev/null +++ b/database/migrations/2023_12_29_160709_create_previsional_incomes_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('id_user'); + $table->unsignedBigInteger('id_type_income'); + $table->double('amount'); + $table->string('description', 200)->default(''); + $table->date('date'); + + $table->foreign('id_user') + ->references('id')->on('users'); + $table->foreign('id_type_income') + ->references('id')->on('type_incomes'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('previsional_incomes'); + } +};