From 06c1d292bba61df25c52bae06e0af9cc40dfd719 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Mon, 13 May 2024 19:52:05 -0400 Subject: [PATCH] Add some migrations for the CodeIgniter application. --- .../Migrations/2024-05-13-011205_AddUsers.php | 39 +++++++++++ .../2024-05-13-012059_CreateChannels.php | 68 +++++++++++++++++++ .../2024-05-13-013011_CreateEpisodes.php | 18 +++++ sql/01-users.sql | 2 +- sql/02-images.sql | 2 +- sql/03-channels.sql | 2 +- sql/04-episodes.sql | 2 +- sql/05-transactions.sql | 3 + 8 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 app/app/Database/Migrations/2024-05-13-011205_AddUsers.php create mode 100644 app/app/Database/Migrations/2024-05-13-012059_CreateChannels.php create mode 100644 app/app/Database/Migrations/2024-05-13-013011_CreateEpisodes.php create mode 100644 sql/05-transactions.sql diff --git a/app/app/Database/Migrations/2024-05-13-011205_AddUsers.php b/app/app/Database/Migrations/2024-05-13-011205_AddUsers.php new file mode 100644 index 0000000..f9e4864 --- /dev/null +++ b/app/app/Database/Migrations/2024-05-13-011205_AddUsers.php @@ -0,0 +1,39 @@ +forge->addField([ + 'id' => [ + 'type' => 'INT', + 'unsigned' => true, + 'auto_increment' => true, + ], + 'email' => [ + 'type' => 'VARCHAR', + 'constraint' => 255 + ], + 'password' => [ + 'type' => 'VARCHAR', + 'constraint' => 255, + ], + 'name' => [ + 'type' => 'VARCHARD', + 'constraint' => 255, + ] + ]); + + $this->forge->addKey('id', true); + $this->forge->createTable('users'); + } + + public function down(): void + { + $this->forge->dropTable('users'); + } +} diff --git a/app/app/Database/Migrations/2024-05-13-012059_CreateChannels.php b/app/app/Database/Migrations/2024-05-13-012059_CreateChannels.php new file mode 100644 index 0000000..c10ef2c --- /dev/null +++ b/app/app/Database/Migrations/2024-05-13-012059_CreateChannels.php @@ -0,0 +1,68 @@ +forge->addField([ + 'id' => [ + 'type' => 'INT', + 'unsigned' => true, + 'auto_increment' => true, + ], + 'name' => [ + 'type' => 'VARCHAR', + 'constraint' => 255, + ], + 'description' => [ + 'type' => 'TEXT', + ], + 'link' => [ + 'type' => 'TEXT' + ], + 'language' => [ + 'type' => 'VARCHAR', + 'constraint' => 2, + ], + 'copyright' => [ + 'type' => 'VARCHAR', + 'constraint', 255, + ], + + ] + ]); + + $this->forge->createTable('channels'); + } + + public function down(): void + { + $this->forge->dropTable('channels'); + } +} diff --git a/app/app/Database/Migrations/2024-05-13-013011_CreateEpisodes.php b/app/app/Database/Migrations/2024-05-13-013011_CreateEpisodes.php new file mode 100644 index 0000000..1e16460 --- /dev/null +++ b/app/app/Database/Migrations/2024-05-13-013011_CreateEpisodes.php @@ -0,0 +1,18 @@ +