create table beneficiary
(
id serial primary key,
name varchar(255),
is_deleted boolean default false,
type integer,
company_uuid varchar,
uuid varchar default gen_random_uuid() not null,
);
create index beneficiary_type_idx
on beneficiary using hash (type);
create index beneficiary_name_gin_idx
on beneficiary using gin (name gin_trgm_ops);
create unique index beneficiary_uuid_idx
on beneficiary (uuid);
create index beneficiary_company_uuid_idx
on beneficiary (company_uuid)
where (company_uuid IS NOT NULL);
~$ yii migration/create beneficiary
Yii 2 Migration Generator Tool v4.4.1
> 1 table excluded by the config.
> Generating migration for creating table 'beneficiary' ...DONE!
> Saved as '/var/www/console/migrations/schema/m241125_214006_create_table_beneficiary.php'
Generated 1 file
(!) Remember to verify files before applying migration.
use yii\db\pgsql\QueryBuilder;
public function safeUp()
{
$this->createTable('beneficiary', [
'id' => $this->primaryKey(),
'name' => $this->string(),
'is_deleted' => $this->boolean()->defaultValue(false),
'type' => $this->integer(),
'company_uuid' => $this->string(),
'uuid' => 'varchar DEFAULT gen_random_uuid() NOT NULL',
]);
$this->createIndex('beneficiary_type_idx', 'beneficiary', 'type', QueryBuilder::INDEX_HASH);
$this->createIndex('beneficiary_uuid_idx', 'beneficiary', 'uuid', QueryBuilder::INDEX_UNIQUE);
$this->execute('CREATE INDEX [[beneficiary_name_gin_idx]] ON [[beneficiary]] USING gin ({{name}} gin_trgm_ops);');
$this->execute("CREATE INDEX [[beneficiary_company_uuid_idx]] ON [[beneficiary]] USING btree ({{company_uuid}}) WHERE {{company_uuid}} IS NOT NULL;");
}
I haven't checked if Yii can detect any of these although I'm surprised by the lack of bool default.
Is there any chance you could prepare PR fixing at least some parts of it?
Describe the bug
No support:
DB Schema:
Generated file
Expected behavior
Additional context DB: Pstgresql 15.3
Affected versions v4.4.1