Skip to content

Commit

Permalink
[#2] Completed publisher page
Browse files Browse the repository at this point in the history
  • Loading branch information
LeikoDmitry committed Nov 23, 2023
1 parent be13ad3 commit 2c0ba80
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install project dependencies
run: composer install --prefer-dist && composer dump-autoload
- name: Run doctrine migrations
run: php bin/console doctrine:migrations:diff --env=test --no-interaction && php bin/console doctrine:migrations:migrate --env=test --no-interaction
run: php bin/console doctrine:migrations:migrate --env=test --no-interaction
- name: Load fixture
run: php bin/console doctrine:fixtures:load --no-interaction --env=test
- name: Run tests and collect coverage
Expand Down
60 changes: 0 additions & 60 deletions migrations/Version20231123220812.php

This file was deleted.

31 changes: 0 additions & 31 deletions migrations/Version20231123225924.php

This file was deleted.

75 changes: 75 additions & 0 deletions migrations/Version20231123230530.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231123230530 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE book_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE book_category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE book_format_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE book_relation_to_book_format_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE review_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE subscriber_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE book (id INT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, authors TEXT DEFAULT NULL, isbn VARCHAR(13) DEFAULT NULL, description TEXT DEFAULT NULL, publication_date DATE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('COMMENT ON COLUMN book.authors IS \'(DC2Type:simple_array)\'');
$this->addSql('COMMENT ON COLUMN book.publication_date IS \'(DC2Type:date_immutable)\'');
$this->addSql('CREATE TABLE book_to_book_category (book_id INT NOT NULL, book_category_id INT NOT NULL, PRIMARY KEY(book_id, book_category_id))');
$this->addSql('CREATE INDEX IDX_57511BE216A2B381 ON book_to_book_category (book_id)');
$this->addSql('CREATE INDEX IDX_57511BE240B1D29E ON book_to_book_category (book_category_id)');
$this->addSql('CREATE TABLE book_category (id INT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(125) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE book_format (id INT NOT NULL, title VARCHAR(255) NOT NULL, description TEXT NOT NULL, comment VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE book_relation_to_book_format (id INT NOT NULL, book_id INT NOT NULL, format_id INT NOT NULL, price NUMERIC(10, 2) NOT NULL, discount_percent INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B42829B916A2B381 ON book_relation_to_book_format (book_id)');
$this->addSql('CREATE INDEX IDX_B42829B9D629F605 ON book_relation_to_book_format (format_id)');
$this->addSql('CREATE TABLE review (id INT NOT NULL, book_id INT NOT NULL, rating INT NOT NULL, content TEXT NOT NULL, author VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_794381C616A2B381 ON review (book_id)');
$this->addSql('COMMENT ON COLUMN review.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE subscriber (id INT NOT NULL, email VARCHAR(100) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('COMMENT ON COLUMN subscriber.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE book_to_book_category ADD CONSTRAINT FK_57511BE216A2B381 FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE book_to_book_category ADD CONSTRAINT FK_57511BE240B1D29E FOREIGN KEY (book_category_id) REFERENCES book_category (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE book_relation_to_book_format ADD CONSTRAINT FK_B42829B916A2B381 FOREIGN KEY (book_id) REFERENCES book (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE book_relation_to_book_format ADD CONSTRAINT FK_B42829B9D629F605 FOREIGN KEY (format_id) REFERENCES book_format (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE review ADD CONSTRAINT FK_794381C616A2B381 FOREIGN KEY (book_id) REFERENCES book (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE book_id_seq CASCADE');
$this->addSql('DROP SEQUENCE book_category_id_seq CASCADE');
$this->addSql('DROP SEQUENCE book_format_id_seq CASCADE');
$this->addSql('DROP SEQUENCE book_relation_to_book_format_id_seq CASCADE');
$this->addSql('DROP SEQUENCE review_id_seq CASCADE');
$this->addSql('DROP SEQUENCE subscriber_id_seq CASCADE');
$this->addSql('ALTER TABLE book_to_book_category DROP CONSTRAINT FK_57511BE216A2B381');
$this->addSql('ALTER TABLE book_to_book_category DROP CONSTRAINT FK_57511BE240B1D29E');
$this->addSql('ALTER TABLE book_relation_to_book_format DROP CONSTRAINT FK_B42829B916A2B381');
$this->addSql('ALTER TABLE book_relation_to_book_format DROP CONSTRAINT FK_B42829B9D629F605');
$this->addSql('ALTER TABLE review DROP CONSTRAINT FK_794381C616A2B381');
$this->addSql('DROP TABLE book');
$this->addSql('DROP TABLE book_to_book_category');
$this->addSql('DROP TABLE book_category');
$this->addSql('DROP TABLE book_format');
$this->addSql('DROP TABLE book_relation_to_book_format');
$this->addSql('DROP TABLE review');
$this->addSql('DROP TABLE subscriber');
}
}

0 comments on commit 2c0ba80

Please sign in to comment.