From 6c049a16750ec83d8c2782afa81963e1e4b36981 Mon Sep 17 00:00:00 2001 From: Brett Spaulding Date: Sun, 4 Aug 2024 21:48:52 -0400 Subject: [PATCH] [ADD] Models: Artist, Album and Song --- php/src/app/Models/Album.php | 11 ++++++ php/src/app/Models/Artist.php | 11 ++++++ php/src/app/Models/Song.php | 11 ++++++ ...2024_08_05_011717_create_artists_table.php | 31 +++++++++++++++ .../2024_08_05_011726_create_albums_table.php | 38 +++++++++++++++++++ .../2024_08_05_011735_create_songs_table.php | 37 ++++++++++++++++++ 6 files changed, 139 insertions(+) create mode 100644 php/src/app/Models/Album.php create mode 100644 php/src/app/Models/Artist.php create mode 100644 php/src/app/Models/Song.php create mode 100644 php/src/database/migrations/2024_08_05_011717_create_artists_table.php create mode 100644 php/src/database/migrations/2024_08_05_011726_create_albums_table.php create mode 100644 php/src/database/migrations/2024_08_05_011735_create_songs_table.php diff --git a/php/src/app/Models/Album.php b/php/src/app/Models/Album.php new file mode 100644 index 0000000..e009242 --- /dev/null +++ b/php/src/app/Models/Album.php @@ -0,0 +1,11 @@ +id(); + $table->timestamps(); + $table->string('name'); + $table->string('image')->nullable(); + $table->string('url_remote')->nullable(); + $table->string('url_local')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('artists'); + } +}; diff --git a/php/src/database/migrations/2024_08_05_011726_create_albums_table.php b/php/src/database/migrations/2024_08_05_011726_create_albums_table.php new file mode 100644 index 0000000..e13c029 --- /dev/null +++ b/php/src/database/migrations/2024_08_05_011726_create_albums_table.php @@ -0,0 +1,38 @@ +id(); + $table->timestamps(); + $table->string('name'); + $table->string('image')->nullable(); + $table->foreignId('artist_id')->constrained(Artist::class); + $table->string('url_remote')->nullable(); + $table->string('url_local')->nullable(); + $table->enum('state', [ + 'pending', + 'in_progress', + 'done', + ])->default('pending'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('albums'); + } +}; diff --git a/php/src/database/migrations/2024_08_05_011735_create_songs_table.php b/php/src/database/migrations/2024_08_05_011735_create_songs_table.php new file mode 100644 index 0000000..c6860dc --- /dev/null +++ b/php/src/database/migrations/2024_08_05_011735_create_songs_table.php @@ -0,0 +1,37 @@ +id(); + $table->timestamps(); + $table->string('name'); + $table->foreignId('album_id')->constrained(Album::class); + $table->string('url_remote')->nullable(); + $table->string('url_local')->nullable(); + $table->enum('state', [ + 'pending', + 'in_progress', + 'done', + ])->default('pending'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('songs'); + } +};