diff --git a/database/migrations/2024_07_30_102537_create_portfolios_table.php b/database/migrations/2021_01_30_102537_create_portfolios_table.php similarity index 100% rename from database/migrations/2024_07_30_102537_create_portfolios_table.php rename to database/migrations/2021_01_30_102537_create_portfolios_table.php diff --git a/database/migrations/2024_07_30_112537_create_portfolio_users_table.php b/database/migrations/2021_01_30_112537_create_portfolio_users_table.php similarity index 100% rename from database/migrations/2024_07_30_112537_create_portfolio_users_table.php rename to database/migrations/2021_01_30_112537_create_portfolio_users_table.php diff --git a/database/migrations/2021_02_25_041227_create_daily_change_table.php b/database/migrations/2021_02_25_041227_create_daily_change_table.php new file mode 100644 index 0000000..653618d --- /dev/null +++ b/database/migrations/2021_02_25_041227_create_daily_change_table.php @@ -0,0 +1,40 @@ +date('date'); + $table->foreignIdFor(Portfolio::class, 'portfolio_id')->onDelete('cascade'); + $table->float('total_market_value', 12, 4)->nullable(); + $table->float('total_cost_basis', 12, 4)->nullable(); + $table->float('total_gain_loss', 12, 4)->nullable(); + $table->float('total_dividends', 12, 4)->nullable(); + $table->float('realized_gains', 12, 4)->nullable(); + $table->text('notes')->nullable(); + + $table->primary(['date', 'portfolio_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('daily_change'); + } +} diff --git a/database/migrations/2021_02_25_041236_create_dividends_table.php b/database/migrations/2021_02_25_041236_create_dividends_table.php new file mode 100644 index 0000000..21528be --- /dev/null +++ b/database/migrations/2021_02_25_041236_create_dividends_table.php @@ -0,0 +1,34 @@ +id(); + $table->date('date'); + $table->string('symbol'); + $table->float('dividend_amount', 12, 4); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('dividends'); + } +} diff --git a/database/migrations/2021_02_25_041246_create_splits_table.php b/database/migrations/2021_02_25_041246_create_splits_table.php new file mode 100644 index 0000000..21093df --- /dev/null +++ b/database/migrations/2021_02_25_041246_create_splits_table.php @@ -0,0 +1,34 @@ +id(); + $table->date('date'); + $table->string('symbol'); + $table->float('split_amount', 12, 4); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('splits'); + } +} diff --git a/database/migrations/2021_02_25_041257_create_transactions_table.php b/database/migrations/2021_02_25_041257_create_transactions_table.php new file mode 100644 index 0000000..abd03f3 --- /dev/null +++ b/database/migrations/2021_02_25_041257_create_transactions_table.php @@ -0,0 +1,40 @@ +id(); + $table->string('symbol'); + $table->foreignIdFor(Portfolio::class, 'portfolio_id')->onDelete('cascade'); + $table->string('transaction_type'); + $table->float('quantity', 12, 4); + $table->float('cost_basis', 12, 4); + $table->float('sale_price', 12, 4)->nullable(); + $table->boolean('split')->nullable(); + $table->date('date'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('transactions'); + } +} diff --git a/database/migrations/2021_02_26_041257_create_market_data_table.php b/database/migrations/2021_02_26_041257_create_market_data_table.php new file mode 100644 index 0000000..2b01286 --- /dev/null +++ b/database/migrations/2021_02_26_041257_create_market_data_table.php @@ -0,0 +1,37 @@ +string('symbol')->primary(); + $table->string('name'); + $table->float('market_value', 12, 4); + $table->float('fifty_two_week_low', 12, 4); + $table->float('fifty_two_week_high', 12, 4); + $table->timestamp('splits_synced_to_holdings_at')->nullable(); + $table->timestamp('dividend_date')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('market_data'); + } +} diff --git a/database/migrations/2021_09_06_014744_create_holdings_table.php b/database/migrations/2021_09_06_014744_create_holdings_table.php new file mode 100644 index 0000000..568bf98 --- /dev/null +++ b/database/migrations/2021_09_06_014744_create_holdings_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignIdFor(Portfolio::class, 'portfolio_id')->onDelete('cascade'); + $table->string('symbol'); + $table->float('quantity', 12, 4); + $table->float('average_cost_basis', 12, 4); + $table->float('total_cost_basis', 12, 4)->nullable(); + $table->float('realized_gain_loss_dollars', 12, 4)->nullable(); + $table->float('dividends_earned', 12, 4)->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('holdings'); + } +}