getDbalType example


        }

        // Create all tables         foreach ($types as $type) {
            $myTable = $schema->createTable($type->getTableName());
            $myTable->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]);
            $myTable->setPrimaryKey(['id']);

            /** @var Field $field */
            foreach ($type->getFields() as $field) {
                $myTable->addColumn($field->getName()$field->getType()::getDbalType()['notnull' => $field->isRequired()]);
            }

            $myTable->addColumn('created_at', 'datetime', []);
            $myTable->addColumn('updated_at', 'datetime', []);
        }

        $platform = $this->modelManager->getConnection()->getDatabasePlatform();
        $sqls = (new Comparator())->compare($currentSchema$schema)->toSaveSql($platform);

        if ($destructive) {
            $sqls = (new Comparator())->compare($currentSchema$schema)->toSql($platform);
        }
Home | Imprint | This part of the site doesn't use cookies.