table('schools', [ 'id' => false, 'primary_key' => ['idschool'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_unicode_ci', ]) ->addColumn('idschool', 'integer', ['signed' => false, 'identity' => true]) ->addColumn('name', 'string', ['limit' => 191]) ->addColumn('slug', 'string', ['limit' => 100, 'comment' => 'usato per URL/sottodominio/widget']) ->addColumn('email', 'string', ['limit' => 191, 'null' => true]) ->addColumn('phone', 'string', ['limit' => 40, 'null' => true]) ->addColumn('address', 'string', ['limit' => 255, 'null' => true]) ->addColumn('city', 'string', ['limit' => 100, 'null' => true]) ->addColumn('postcode', 'string', ['limit' => 20, 'null' => true]) ->addColumn('country', 'string', ['limit' => 2, 'default' => 'IT']) ->addColumn('vat_number', 'string', ['limit' => 30, 'null' => true]) ->addColumn('logo', 'string', ['limit' => 191, 'null' => true]) ->addColumn('timezone', 'string', ['limit' => 50, 'default' => 'Europe/Rome']) ->addColumn('locale', 'string', ['limit' => 5, 'default' => 'it']) ->addColumn('currency', 'string', ['limit' => 3, 'default' => 'EUR']) ->addColumn('status', 'string', ['limit' => 20, 'default' => 'active', 'comment' => 'active|suspended|trial']) ->addColumn('created_at', 'timestamp', ['null' => true, 'default' => 'CURRENT_TIMESTAMP']) ->addColumn('updated_at', 'timestamp', ['null' => true, 'default' => null, 'update' => 'CURRENT_TIMESTAMP']) ->addIndex(['slug'], ['unique' => true, 'name' => 'schools_slug_unique']) ->addIndex(['status'], ['name' => 'schools_status_index']) ->create(); // Seregno = scuola 1 (dati da completare poi dal pannello) $this->table('schools')->insert([ 'idschool' => 1, 'name' => 'Scuola Yoga Seregno', 'slug' => 'seregno', 'city' => 'Seregno', 'country' => 'IT', ])->saveData(); } public function down(): void { $this->table('schools')->drop()->save(); } }