destructr/examples/example_factory.php

35 lines
969 B
PHP
Raw Normal View History

2020-08-26 17:53:27 +00:00
<?php
use Destructr\Factory;
2020-08-29 21:54:37 +00:00
class ExampleFactory extends Factory
{
2020-08-26 17:53:27 +00:00
/**
2020-08-29 21:54:37 +00:00
* Example factory with a different schema, to index on random_data for faster searching
2020-08-26 17:53:27 +00:00
*/
protected $schema = [
2020-08-26 17:53:27 +00:00
'dso.id' => [
2020-08-29 21:54:37 +00:00
'name' => 'dso_id', //column name to be used
'type' => 'VARCHAR(16)', //column type
'index' => 'BTREE', //whether/how to index
'unique' => true, //whether column should be unique
'primary' => true, //whether column should be the primary key
],
'dso.type' => [
'name' => 'dso_type',
'type' => 'VARCHAR(30)',
2020-08-26 17:53:27 +00:00
'index' => 'BTREE',
],
'dso.deleted' => [
2020-08-29 21:54:37 +00:00
'name' => 'dso_deleted',
'type' => 'BIGINT',
'index' => 'BTREE',
2020-08-26 17:53:27 +00:00
],
'random_data' => [
2020-08-29 21:54:37 +00:00
'name' => 'random_data',
'type' => 'VARCHAR(64)',
'index' => 'BTREE',
],
2020-08-26 17:53:27 +00:00
];
2020-08-29 21:54:37 +00:00
}