From 5541a4f5cc2ac19e60c01b075e401205ade5cf6e Mon Sep 17 00:00:00 2001 From: Ferrol Date: Tue, 19 May 2020 23:25:35 +0200 Subject: [PATCH 1/2] Readme - Delete enviroment vars instructions (No efect in docker) --- Readme.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Readme.md b/Readme.md index 68e386f..600cbc2 100644 --- a/Readme.md +++ b/Readme.md @@ -3,12 +3,6 @@ ``` bash $ cp .env.dist .env - -# Debemos indicar las variables de entorno - root_pwd=my-super-secret - db_name=api_platform - db_user=root - db_password= ``` #### Docker: Levantamos los servicios y comandos de interes From 4b58beb78bb3cc3652b41c7b7da2a67bcbeb5f2c Mon Sep 17 00:00:00 2001 From: Ferrol Date: Tue, 19 May 2020 23:36:38 +0200 Subject: [PATCH 2/2] Migrations Delete make:migration command from entrypoint: The command was running every time the container up. This were generating many repeated migration files So we include a the migration file into the repository --- docker/app/docker-entrypoint.sh | 1 - src/Migrations/Version20200519181249.php | 37 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/Migrations/Version20200519181249.php diff --git a/docker/app/docker-entrypoint.sh b/docker/app/docker-entrypoint.sh index c9d7e67..d58ebb0 100755 --- a/docker/app/docker-entrypoint.sh +++ b/docker/app/docker-entrypoint.sh @@ -25,7 +25,6 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then elif [ "$APP_ENV" != 'prod' ]; then # Always try to reinstall deps when not in prod composer install --prefer-dist --no-progress --no-suggest --no-interaction - php bin/console make:migration --no-interaction --no-debug --env="${APP_ENV}" php bin/console doctrine:database:create --if-not-exists --no-interaction --no-debug --env="${APP_ENV}" php bin/console doctrine:migrations:migrate --allow-no-migration --no-interaction --no-debug --env="${APP_ENV}" fi diff --git a/src/Migrations/Version20200519181249.php b/src/Migrations/Version20200519181249.php new file mode 100644 index 0000000..a24365f --- /dev/null +++ b/src/Migrations/Version20200519181249.php @@ -0,0 +1,37 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE tweet CHANGE user_image user_image VARCHAR(100) DEFAULT NULL'); + $this->addSql('ALTER TABLE hashtag CHANGE name name VARCHAR(100) DEFAULT NULL, CHANGE last_tweet last_tweet VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE hashtag CHANGE name name VARCHAR(100) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE last_tweet last_tweet VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE tweet CHANGE user_image user_image VARCHAR(100) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + } +}