diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-12-12 11:01:54 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-12-19 10:35:24 +0100 |
commit | a48b5d5a5aa437cff0474321962c12b0e045dbf8 (patch) | |
tree | 92b6cf88b73d48663fc28b62738bcfe7f99bbf68 | |
parent | 68cb89a5161351dd730871fc834bf147204a2a07 (diff) | |
download | wallabag-a48b5d5a5aa437cff0474321962c12b0e045dbf8.tar.gz wallabag-a48b5d5a5aa437cff0474321962c12b0e045dbf8.tar.zst wallabag-a48b5d5a5aa437cff0474321962c12b0e045dbf8.zip |
Run migration in test, ready for MySQL
-rw-r--r-- | app/DoctrineMigrations/Version20161022134138.php | 6 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161031132655.php | 4 | ||||
-rw-r--r-- | build.xml | 101 |
3 files changed, 98 insertions, 13 deletions
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php index b3d02b40..3ac8cc5b 100644 --- a/app/DoctrineMigrations/Version20161022134138.php +++ b/app/DoctrineMigrations/Version20161022134138.php | |||
@@ -33,6 +33,12 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI | |||
33 | 33 | ||
34 | $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); | 34 | $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); |
35 | 35 | ||
36 | // convert field length for utf8mb4 | ||
37 | // http://stackoverflow.com/a/31474509/569101 | ||
38 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE confirmation_token confirmation_token VARCHAR(180) NOT NULL;'); | ||
39 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE salt salt VARCHAR(180) NOT NULL;'); | ||
40 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE password password VARCHAR(180) NOT NULL;'); | ||
41 | |||
36 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 42 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
37 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 43 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
38 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 44 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php index 770ad2d8..f81898ff 100644 --- a/app/DoctrineMigrations/Version20161031132655.php +++ b/app/DoctrineMigrations/Version20161031132655.php | |||
@@ -36,7 +36,7 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI | |||
36 | 36 | ||
37 | $this->skipIf(false !== $images, 'It seems that you already played this migration.'); | 37 | $this->skipIf(false !== $images, 'It seems that you already played this migration.'); |
38 | 38 | ||
39 | $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); | 39 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); |
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** |
@@ -44,6 +44,6 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI | |||
44 | */ | 44 | */ |
45 | public function down(Schema $schema) | 45 | public function down(Schema $schema) |
46 | { | 46 | { |
47 | $this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'download_images_enabled';"); | 47 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled';"); |
48 | } | 48 | } |
49 | } | 49 | } |
@@ -1,9 +1,9 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project name="wallabag" default="build"> | 2 | <project name="wallabag" default="build"> |
3 | <target name="build" depends="clean,prepare,phpunit"/> | 3 | <target name="build" depends="clean,prepare,phpunit"/> |
4 | <target name="prepare-mysql" depends="clean,db_mysql,prepare"/> | 4 | <target name="prepare-mysql" depends="clean,prepare_mysql"/> |
5 | <target name="prepare-sqlite" depends="clean,db_sqlite,prepare"/> | 5 | <target name="prepare-sqlite" depends="clean,prepare_sqlite"/> |
6 | <target name="prepare-pgsql" depends="clean,db_pgsql,prepare"/> | 6 | <target name="prepare-pgsql" depends="clean,prepare_pgsql"/> |
7 | 7 | ||
8 | <target name="clean" description="Cleanup build artifacts"> | 8 | <target name="clean" description="Cleanup build artifacts"> |
9 | <delete dir="${basedir}/var/cache"/> | 9 | <delete dir="${basedir}/var/cache"/> |
@@ -28,11 +28,6 @@ | |||
28 | </exec> | 28 | </exec> |
29 | <exec executable="php"> | 29 | <exec executable="php"> |
30 | <arg value="${basedir}/bin/console"/> | 30 | <arg value="${basedir}/bin/console"/> |
31 | <arg value="cache:clear"/> | ||
32 | <arg value="--env=test"/> | ||
33 | </exec> | ||
34 | <exec executable="php"> | ||
35 | <arg value="${basedir}/bin/console"/> | ||
36 | <arg value="doctrine:fixtures:load"/> | 31 | <arg value="doctrine:fixtures:load"/> |
37 | <arg value="--no-interaction"/> | 32 | <arg value="--no-interaction"/> |
38 | <arg value="--env=test"/> | 33 | <arg value="--env=test"/> |
@@ -45,12 +40,40 @@ | |||
45 | <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/> | 40 | <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/> |
46 | <arg value="${basedir}/app/config/parameters_test.yml"/> | 41 | <arg value="${basedir}/app/config/parameters_test.yml"/> |
47 | </exec> | 42 | </exec> |
48 | |||
49 | <exec executable="php"> | 43 | <exec executable="php"> |
50 | <arg value="${basedir}/bin/console"/> | 44 | <arg value="${basedir}/bin/console"/> |
51 | <arg value="cache:clear"/> | 45 | <arg value="cache:clear"/> |
52 | <arg value="--env=test"/> | 46 | <arg value="--env=test"/> |
53 | </exec> | 47 | </exec> |
48 | <exec executable="php"> | ||
49 | <arg value="${basedir}/bin/console"/> | ||
50 | <arg value="doctrine:database:drop"/> | ||
51 | <arg value="--force"/> | ||
52 | <arg value="--env=test"/> | ||
53 | </exec> | ||
54 | <exec executable="php"> | ||
55 | <arg value="${basedir}/bin/console"/> | ||
56 | <arg value="doctrine:database:create"/> | ||
57 | <arg value="--env=test"/> | ||
58 | </exec> | ||
59 | <exec executable="php"> | ||
60 | <arg value="${basedir}/bin/console"/> | ||
61 | <arg value="doctrine:database:import"/> | ||
62 | <arg value="data/sql/mysql_base.sql"/> | ||
63 | <arg value="--env=test"/> | ||
64 | </exec> | ||
65 | <exec executable="php"> | ||
66 | <arg value="${basedir}/bin/console"/> | ||
67 | <arg value="doctrine:migrations:migrate"/> | ||
68 | <arg value="--no-interaction"/> | ||
69 | <arg value="--env=test"/> | ||
70 | </exec> | ||
71 | <exec executable="php"> | ||
72 | <arg value="${basedir}/bin/console"/> | ||
73 | <arg value="doctrine:fixtures:load"/> | ||
74 | <arg value="--no-interaction"/> | ||
75 | <arg value="--env=test"/> | ||
76 | </exec> | ||
54 | </target> | 77 | </target> |
55 | 78 | ||
56 | <target name="db_sqlite" description="Run test for SQLite"> | 79 | <target name="db_sqlite" description="Run test for SQLite"> |
@@ -59,12 +82,40 @@ | |||
59 | <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/> | 82 | <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/> |
60 | <arg value="${basedir}/app/config/parameters_test.yml"/> | 83 | <arg value="${basedir}/app/config/parameters_test.yml"/> |
61 | </exec> | 84 | </exec> |
62 | |||
63 | <exec executable="php"> | 85 | <exec executable="php"> |
64 | <arg value="${basedir}/bin/console"/> | 86 | <arg value="${basedir}/bin/console"/> |
65 | <arg value="cache:clear"/> | 87 | <arg value="cache:clear"/> |
66 | <arg value="--env=test"/> | 88 | <arg value="--env=test"/> |
67 | </exec> | 89 | </exec> |
90 | <exec executable="php"> | ||
91 | <arg value="${basedir}/bin/console"/> | ||
92 | <arg value="doctrine:database:drop"/> | ||
93 | <arg value="--force"/> | ||
94 | <arg value="--env=test"/> | ||
95 | </exec> | ||
96 | <exec executable="php"> | ||
97 | <arg value="${basedir}/bin/console"/> | ||
98 | <arg value="doctrine:database:create"/> | ||
99 | <arg value="--env=test"/> | ||
100 | </exec> | ||
101 | <exec executable="php"> | ||
102 | <arg value="${basedir}/bin/console"/> | ||
103 | <arg value="doctrine:database:import"/> | ||
104 | <arg value="data/sql/sqlite_base.sql"/> | ||
105 | <arg value="--env=test"/> | ||
106 | </exec> | ||
107 | <exec executable="php"> | ||
108 | <arg value="${basedir}/bin/console"/> | ||
109 | <arg value="doctrine:migrations:migrate"/> | ||
110 | <arg value="--no-interaction"/> | ||
111 | <arg value="--env=test"/> | ||
112 | </exec> | ||
113 | <exec executable="php"> | ||
114 | <arg value="${basedir}/bin/console"/> | ||
115 | <arg value="doctrine:fixtures:load"/> | ||
116 | <arg value="--no-interaction"/> | ||
117 | <arg value="--env=test"/> | ||
118 | </exec> | ||
68 | </target> | 119 | </target> |
69 | 120 | ||
70 | <target name="db_pgsql" description="Run test for PostgreSQL"> | 121 | <target name="db_pgsql" description="Run test for PostgreSQL"> |
@@ -73,12 +124,40 @@ | |||
73 | <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/> | 124 | <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/> |
74 | <arg value="${basedir}/app/config/parameters_test.yml"/> | 125 | <arg value="${basedir}/app/config/parameters_test.yml"/> |
75 | </exec> | 126 | </exec> |
76 | |||
77 | <exec executable="php"> | 127 | <exec executable="php"> |
78 | <arg value="${basedir}/bin/console"/> | 128 | <arg value="${basedir}/bin/console"/> |
79 | <arg value="cache:clear"/> | 129 | <arg value="cache:clear"/> |
80 | <arg value="--env=test"/> | 130 | <arg value="--env=test"/> |
81 | </exec> | 131 | </exec> |
132 | <exec executable="php"> | ||
133 | <arg value="${basedir}/bin/console"/> | ||
134 | <arg value="doctrine:database:drop"/> | ||
135 | <arg value="--force"/> | ||
136 | <arg value="--env=test"/> | ||
137 | </exec> | ||
138 | <exec executable="php"> | ||
139 | <arg value="${basedir}/bin/console"/> | ||
140 | <arg value="doctrine:database:create"/> | ||
141 | <arg value="--env=test"/> | ||
142 | </exec> | ||
143 | <exec executable="php"> | ||
144 | <arg value="${basedir}/bin/console"/> | ||
145 | <arg value="doctrine:database:import"/> | ||
146 | <arg value="data/sql/pgsql_base.sql"/> | ||
147 | <arg value="--env=test"/> | ||
148 | </exec> | ||
149 | <exec executable="php"> | ||
150 | <arg value="${basedir}/bin/console"/> | ||
151 | <arg value="doctrine:migrations:migrate"/> | ||
152 | <arg value="--no-interaction"/> | ||
153 | <arg value="--env=test"/> | ||
154 | </exec> | ||
155 | <exec executable="php"> | ||
156 | <arg value="${basedir}/bin/console"/> | ||
157 | <arg value="doctrine:fixtures:load"/> | ||
158 | <arg value="--no-interaction"/> | ||
159 | <arg value="--env=test"/> | ||
160 | </exec> | ||
82 | </target> | 161 | </target> |
83 | 162 | ||
84 | <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> | 163 | <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> |