Migrate.php 919 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use Schema\Wrapper as Wrapper;
  3. use App\Core\Sanity\MigratorController as Migrator;
  4. //https://book.cakephp.org/phinx/0/en/migrations.html#valid-column-types
  5. function core_cache_upgrade($pluginversion) {
  6. if ($pluginversion < "0.0.1") {
  7. $table = Wrapper::get_table("core_caches");
  8. $table->addColumn("key", "string", Array("null" => false));
  9. $table->addColumn("type", "string", Array("null" => false));
  10. $table->addColumn("format", "string", Array("null" => false));
  11. $table->addColumn("value", "text", Array("null" => true));
  12. $table->addTimestamps();
  13. $table->create();
  14. Migrator::getInstance()->update_plugin_version("core_cache", "1.0.0");
  15. return;
  16. }
  17. }
  18. function core_cache_rollback($pluginversion) {
  19. if($pluginversion > "0.0.1"){
  20. $table = Wrapper::get_table("core_caches");
  21. $table->drop();
  22. return;
  23. }
  24. }