We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I try to define a column with default value = generateUUIDv4()
i try $newTable->addColumn('uuid', 'string', ['default' => 'generateUUIDv4()']); but the value is string not the function ...
$newTable->addColumn('uuid', 'string', ['default' => 'generateUUIDv4()']);
so for the moment i use a little trick like this:
public function up(Schema $schema) : void { /** @var Connection */ $conn = $this->container->get('doctrine.dbal.clickhouse_connection'); /** @var Schema */ $fromSchema = new Schema(); /** @var Schema */ $toSchema = clone $fromSchema; $newTable = $toSchema->createTable('probe_datum'); $newTable->addOption('engine', 'MergeTree'); $newTable->addColumn('uuid', 'string', ['default' => 'generateUUIDv4()']); $newTable->addColumn('datetime_value', 'datetime'); $newTable->addColumn('value', 'float'); $newTable->addColumn('probe_id', 'integer'); $newTable->setPrimaryKey(['uuid', 'datetime_value', 'probe_id']); $sqlArray = $fromSchema->getMigrateToSql($toSchema, $conn->getDatabasePlatform()); foreach ($sqlArray as $sql) { $hackSql = str_replace('\'generateUUIDv4()\'', 'generateUUIDv4()', $sql); $conn->exec($hackSql); } }
how can i do this properly ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I try to define a column with default value = generateUUIDv4()
i try
$newTable->addColumn('uuid', 'string', ['default' => 'generateUUIDv4()']);
but the value is string not the function ...
so for the moment i use a little trick like this:
how can i do this properly ?
The text was updated successfully, but these errors were encountered: