From 16b0198c88dec6d9508418b808c3901446c11aa7 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Thu, 27 Jun 2024 19:24:56 -0400 Subject: [PATCH] Add the rest of the tables. --- .../20240627230956_create_episodes_table.php | 60 +++++++++++++++++++ ...240627231445_create_transactions_table.php | 49 +++++++++++++++ ...20240627231953_create_categories_table.php | 42 +++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 app/db/migrations/20240627230956_create_episodes_table.php create mode 100644 app/db/migrations/20240627231445_create_transactions_table.php create mode 100644 app/db/migrations/20240627231953_create_categories_table.php diff --git a/app/db/migrations/20240627230956_create_episodes_table.php b/app/db/migrations/20240627230956_create_episodes_table.php new file mode 100644 index 0000000..728ed3f --- /dev/null +++ b/app/db/migrations/20240627230956_create_episodes_table.php @@ -0,0 +1,60 @@ +table('episodes')->addTimestamps(); + + $table->addColumn('title', 'string', [ 'null' => false ]) + ->addColumn('link', 'string') + ->addColumn('duration', 'string') + ->addColumn('length', 'integer') + ->addColumn('description', 'text') + ->addColumn('explicit', 'boolean', [ 'default' => false ]) + ->addColumn('channel_id', 'integer') + ->addColumn('image_id', 'integer', [ 'null' => true ]) + ->addForeignKey('channel_id', 'channels') + ->addForeignKey('image_id', 'images'); + + $table->create(); + } +} diff --git a/app/db/migrations/20240627231445_create_transactions_table.php b/app/db/migrations/20240627231445_create_transactions_table.php new file mode 100644 index 0000000..a8cd3eb --- /dev/null +++ b/app/db/migrations/20240627231445_create_transactions_table.php @@ -0,0 +1,49 @@ +table('transactions')->addTimestamps(); + + $table->addColumn('user_id', 'integer', [ 'null' => false ]) + ->addColumn('code', 'string') + ->addColumn('type', 'string') + ->addColumn('total', 'int', [ 'null' => false ]) + ->addForeignKey('user_id', 'user'); + + $table->create(); + } +} diff --git a/app/db/migrations/20240627231953_create_categories_table.php b/app/db/migrations/20240627231953_create_categories_table.php new file mode 100644 index 0000000..fc4e932 --- /dev/null +++ b/app/db/migrations/20240627231953_create_categories_table.php @@ -0,0 +1,42 @@ +table('categories')->addTimestamps(); + + $table->addColumn('name', 'string', [ 'null' => false ]) + ->addIndex('name', [ 'unique' => true ]); + + $table->create(); + } +}