aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-10-23 18:28:34 +0200
committerWilly Micieli <micieli@laposte.net>2019-10-23 18:28:34 +0200
commit667ee46472a44d6b7d425dd548e2daee961dd1fc (patch)
tree2ce987c7e51a64d45bd36027d18d463caafdc06f
parent9ad399b069575068afccf2ae26115386e6bb756a (diff)
downloadimperium-667ee46472a44d6b7d425dd548e2daee961dd1fc.zip
imperium-667ee46472a44d6b7d425dd548e2daee961dd1fc.tar.gz
add migrations to tests admin
-rw-r--r--Makefile3
-rw-r--r--db/migrations/20191023162136_countries.php35
-rw-r--r--db/seeds/CountriesSeed.php25
3 files changed, 61 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e783a4a..e35817b 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,6 @@ OLD=7.2.19
MEDIUM=7.3.6
LAST=7.3.6
-TEST=./impero
C=--coverage-html coverage
@@ -20,6 +19,6 @@ prepare: vendor
mysql -uroot -proot -e 'CREATE DATABASE imperium;'
vendor/bin/phinx migrate
vendor/bin/phinx seed:run
-
+ php shaolin up
vendor:
composer install
diff --git a/db/migrations/20191023162136_countries.php b/db/migrations/20191023162136_countries.php
new file mode 100644
index 0000000..d0b1f32
--- /dev/null
+++ b/db/migrations/20191023162136_countries.php
@@ -0,0 +1,35 @@
+<?php
+
+
+use Phinx\Migration\AbstractMigration;
+
+class Countries 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
+ * renameColumn
+ * addIndex
+ * addForeignKey
+ *
+ * Remember to call "create()" or "update()" and NOT "save()" when working
+ * with the Table class.
+ */
+ public function change()
+ {
+ $this->table('countries')
+ ->addColumn('name','string')
+ ->create();
+ }
+}
diff --git a/db/seeds/CountriesSeed.php b/db/seeds/CountriesSeed.php
new file mode 100644
index 0000000..8f602b6
--- /dev/null
+++ b/db/seeds/CountriesSeed.php
@@ -0,0 +1,25 @@
+<?php
+
+
+use Phinx\Seed\AbstractSeed;
+
+class CountriesSeed extends AbstractSeed
+{
+ /**
+ * Run Method.
+ *
+ * Write your database seeder using this method.
+ *
+ * More information on writing seeders is available here:
+ * http://docs.phinx.org/en/latest/seeding.html
+ */
+ public function run()
+ {
+ $user = collect();
+
+ for ($i=0;$i!=100;$i++)
+ $user->set(['name' => faker()->country]);
+
+ $this->insert('countries',$user->all());
+ }
+}