From 7c50e0338178ce99323da0dc1b038fbff3b47ac4 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Thu, 7 Nov 2024 22:49:59 -0500 Subject: [PATCH] Add the migrations to the container. --- .../20240624022427_create_images.php | 49 ------------------- .../20240624023258_create_channels_table.php | 11 +++-- .../20240627230956_create_episodes_table.php | 11 +++-- ...240627231445_create_transactions_table.php | 4 +- app/phinx.php | 8 +-- dev/php/Dockerfile | 5 ++ 6 files changed, 25 insertions(+), 63 deletions(-) delete mode 100644 app/db/migrations/20240624022427_create_images.php diff --git a/app/db/migrations/20240624022427_create_images.php b/app/db/migrations/20240624022427_create_images.php deleted file mode 100644 index 1c87be6..0000000 --- a/app/db/migrations/20240624022427_create_images.php +++ /dev/null @@ -1,49 +0,0 @@ -table('images')->addTimestamps(); - $table->addColumn('url', 'string') - ->addColumn('title', 'string', [ 'null' => false ]) - ->addColumn('width', 'integer', [ - 'unsigned' => true, - 'null' => true, - ]) - ->addColumn('height', 'integer', [ - 'unsigned' => true, - 'null' => true - ]) - ->addIndex([ 'url' ], [ 'type' => 'unique' ]) - ->create(); - } -} diff --git a/app/db/migrations/20240624023258_create_channels_table.php b/app/db/migrations/20240624023258_create_channels_table.php index 7045e71..c4604c2 100644 --- a/app/db/migrations/20240624023258_create_channels_table.php +++ b/app/db/migrations/20240624023258_create_channels_table.php @@ -16,7 +16,7 @@ CREATE TABLE channels ( category VARCHAR(255), owner_id INT(11) UNSIGNED NOT NULL, - image_id INT(11) UNSIGNED NOT NULL, + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -55,10 +55,13 @@ final class CreateChannelsTable extends AbstractMigration ]) ->addColumn('copyright', 'string') ->addColumn('explicit', 'boolean', [ 'default' => false ]) - ->addColumn('owner_id', 'integer') - ->addColumn('image_id', 'integer', [ + ->addColumn('owner_id', 'integer', [ + 'null' => false, + 'signed' => false, + ]) + ->addColumn('image_id', 'integer', [ 'null' => true, - 'unsigned' => true + 'signed' => false, ]) ->addIndex([ 'name' ], [ 'unique' => true ]) ->addForeignKey('owner_id', 'users') diff --git a/app/db/migrations/20240627230956_create_episodes_table.php b/app/db/migrations/20240627230956_create_episodes_table.php index 401ae48..f59c956 100644 --- a/app/db/migrations/20240627230956_create_episodes_table.php +++ b/app/db/migrations/20240627230956_create_episodes_table.php @@ -47,13 +47,16 @@ final class CreateEpisodesTable extends AbstractMigration $table->addColumn('title', 'string', [ 'null' => false ]) ->addColumn('link', 'string') ->addColumn('duration', 'string') - ->addColumn('length', 'integer', [ 'unsigned' => true ]) + ->addColumn('length', 'integer', [ 'signed' => false ]) ->addColumn('description', 'text') ->addColumn('explicit', 'boolean', [ 'default' => false ]) - ->addColumn('channel_id', 'integer', [ 'unsigned' => true ]) + ->addColumn('channel_id', 'integer', [ + 'signed' => false, + 'null' => false + ]) ->addColumn('image_id', 'integer', [ - 'null' => true, - 'unsigned' => true + 'signed' => false, + 'null' => true ]) ->addForeignKey('channel_id', 'channels') ->addForeignKey('image_id', 'images'); diff --git a/app/db/migrations/20240627231445_create_transactions_table.php b/app/db/migrations/20240627231445_create_transactions_table.php index 3cda19b..eca401b 100644 --- a/app/db/migrations/20240627231445_create_transactions_table.php +++ b/app/db/migrations/20240627231445_create_transactions_table.php @@ -38,11 +38,11 @@ final class CreateTransactionsTable extends AbstractMigration { $table = $this->table('transactions')->addTimestamps(); - $table->addColumn('user_id', 'integer', [ 'null' => false ]) + $table->addColumn('user_id', 'integer', [ 'signed' => false, 'null' => false ]) ->addColumn('code', 'string') ->addColumn('type', 'string') ->addColumn('total', 'integer', [ 'null' => false ]) - ->addForeignKey('user_id', 'user'); + ->addForeignKey('user_id', 'users'); $table->create(); } diff --git a/app/phinx.php b/app/phinx.php index 7ff2b08..4565ffd 100644 --- a/app/phinx.php +++ b/app/phinx.php @@ -20,10 +20,10 @@ return ], 'development' => [ 'adapter' => 'mysql', - 'host' => 'localhost', - 'name' => 'development_db', - 'user' => 'root', - 'pass' => '', + 'host' => 'mariadb', + 'name' => 'slovocast', + 'user' => 'slovocast', + 'pass' => 'password', 'port' => '3306', 'charset' => 'utf8', ], diff --git a/dev/php/Dockerfile b/dev/php/Dockerfile index b5944b6..d5653ea 100644 --- a/dev/php/Dockerfile +++ b/dev/php/Dockerfile @@ -1,5 +1,7 @@ FROM php:8.3-fpm +WORKDIR /var/www/slovocast + RUN apt-get update && \ apt-get install -y libonig-dev \ zip \ @@ -7,3 +9,6 @@ RUN apt-get update && \ libpng-dev RUN docker-php-ext-install pdo pdo_mysql mbstring gd zip +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +