create start-up script for migration

This commit is contained in:
GotPPay
2018-06-26 13:47:39 +02:00
parent 37c749a9d7
commit 9b26ff1cd4
3 changed files with 66 additions and 6 deletions

View File

@@ -0,0 +1,41 @@
<?php
use Phinx\Migration\AbstractMigration;
class AddBillingInfoToOrderMigration extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* addCustomColumn
* renameColumn
* addIndex
* addForeignKey
*
* Any other distructive changes will result in an error when trying to
* rollback the migration.
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$ordersTable = $this->table('orders');
$ordersTable->addColumn('billingFirstName', 'string', ['limit' => 100, 'null' => true, 'after'=>'billingAddress'])
->addColumn('billingLastName', 'string', ['limit'=>100, 'null'=> true, 'after'=>'billingFirstName'])
->addColumn('billingMail', 'string', ['limit'=>300, 'null' => true, 'after'=>'billingLastName'])
->save();
}
}

13
docker/php/startup.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
#migrate DB
cd /var/www/html/api-wiaas
while ! mysqladmin ping -h"db" --silent; do
sleep 1
done
echo "Ready...."
vendor/bin/phinx migrate -e development
#start image
exec apache2-foreground

View File

@@ -17,19 +17,22 @@ ENV DB_SERVER=db \
ENV DEV_DB_HOST=db \
DEV_DB_NAME=ricoh_dash \
DEV_DB_USER=developer \
DEV_DB_PASS=developer
DEV_DB_PASS=developer \
DEV_DB_PORT=3306
ENV PROD_DB_HOST=db \
PROD_DB_NAME=ricoh_dash \
PROD_DB_USER=developer \
PROD_DB_PASS=developer
PROD_DB_PASS=developer \
DEV_DB_PORT=3306
ENV TEST_DB_HOST=db \
TEST_DB_NAME=ricoh_dash \
TEST_DB_USER=developer \
TEST_DB_PASS=developer
TEST_DB_PASS=developer \
DEV_DB_PORT=3306
RUN apt-get update && apt-get install -y git unzip gnupg
RUN apt-get update && apt-get install -y git unzip gnupg mysql-client
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
@@ -38,8 +41,9 @@ RUN a2enmod rewrite
COPY docker/php/apache2.conf /etc/apache2/
COPY docker/php/composer.phar /usr/local/bin/composer
COPY docker/php/startup.sh /init-scripts/
RUN chmod 755 /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer && chmod +x /init-scripts/startup.sh
COPY api-wiaas /home/wiaas/api-wiaas
COPY client-wiaas /home/wiaas/client-wiaas
@@ -56,3 +60,5 @@ RUN npm install && npm run build
RUN cp -r build/* /var/www/html/
COPY docker/php/.htaccess /var/www/html/
CMD /init-scripts/startup.sh