Add more styles and test the site.

This commit is contained in:
Dave Smith-Hayes 2024-11-07 23:05:27 -05:00
parent f40be66381
commit 7805ce9f80
4 changed files with 61 additions and 3 deletions

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
/*
CREATE TABLE images (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
url TEXT NOT NULL,
title TEXT NULL,
width INT(11) UNSIGNED NULL,
height INT(11) UNSIGNED NULL,
PRIMARY KEY(`id`),
UNIQUE KEY(`url`)
);
*/
final class CreateImagesTable extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$table = $this->table('images')->addTimestamps();
$table->addColumn('url', 'string')
->addColumn('title', 'string', [ 'null' => false ])
->addColumn('width', 'integer', [
'null' => true,
'signed' => false,
])
->addColumn('height', 'integer', [
'null' => true,
'signed' => false
])
->addIndex([ 'url' ], [ 'type' => 'unique' ])
->create();
}
}

View File

@ -41,6 +41,12 @@ main {
box-sizing: border-box; box-sizing: border-box;
} }
.error {
padding: 0.5em;
border: 1px solid #140505;
background-color: #C32727;
}
footer { footer {
text-align: right; text-align: right;
padding: 0.25em 1em; padding: 0.25em 1em;

View File

@ -52,7 +52,7 @@ class ChannelRepository implements ChannelRepositoryInterface
$statement->execute([ ':id' => $id ]); $statement->execute([ ':id' => $id ]);
$results = $statement->fetch(\PDO::FETCH_ASSOC); $results = $statement->fetch(\PDO::FETCH_ASSOC);
if (!count($results)) { if (!is_array($results) || !count($results)) {
throw new EntityNotFoundException("Unable to find Channel"); throw new EntityNotFoundException("Unable to find Channel");
} }
@ -70,7 +70,7 @@ class ChannelRepository implements ChannelRepositoryInterface
$statement->execute([ ':id' => $user->getId() ]); $statement->execute([ ':id' => $user->getId() ]);
$results = $statement->fetch(\PDO::FETCH_ASSOC); $results = $statement->fetch(\PDO::FETCH_ASSOC);
if (!count($results)) { if (!is_array($results) || !count($results)) {
throw new EntityNotFoundException("Unable to find Channel"); throw new EntityNotFoundException("Unable to find Channel");
} }
@ -88,7 +88,7 @@ class ChannelRepository implements ChannelRepositoryInterface
$statement->execute([ ':slug' => $slug ]); $statement->execute([ ':slug' => $slug ]);
$results = $statement->fetch(\PDO::FETCH_ASSOC); $results = $statement->fetch(\PDO::FETCH_ASSOC);
if (!count($results)) { if (!is_array($results) || !count($results)) {
throw new EntityNotFoundException("Unable to find Channel"); throw new EntityNotFoundException("Unable to find Channel");
} }

3
dev/php/migrations.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/bash
composer run phinx migrate -e development