I would like to use the migrations:generate occ command.
Currently, the application version is 0.0.1. I changed to 0.1.1.
Then, I inputed this command : sudo -u nginx php occ migrations:generate workspace 0100 and here is the result :
I don’t under why it doesn’t work ?
The appid and my release mapped on 3 digits are corrects…
Thanks for your help !
Edit - 14 june at 4.23 pm
Aaah ! I didn’t see this message :
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
I run the sudo -u nginx php occ migrations:generate workspace 0000 command again. And I have always the same problem…
Finally, I found the problem !
It was a problem permission in my app project.
I changed the owner with this command : sudo chown nginx: -R <path to app project>, then I ran the sudo -u nginx php occ migrations:generate workspace 0000 command again and it worked !
Hovewer, the occ command doesn’t return an error message for a permission problem.
Does it have to a performance normal ?
Otherwise, can I create an issue to resolve this problem ?
After I generated my migration file.
I don’t see how do I destroy/refresh/rollback my database table with occ command ?
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
return null;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
For example, I know Laravel Framework, it is my reference only… ^^’
With Laravel, I define my migration like this :
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFlightsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('airline');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('flights');
}
}
So, they (Laravel dev teams) have a down function called with php artisan migrate:rollback or php artisan migrate:refresh command when you want to apply changes.