if this- isTableExist ads offer this- createTable ads offer id Schema

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
if (!$this->isTableExist('ads.offer')) {
$this->createTable('ads.offer', [
'id' => Schema::TYPE_PK,
'site_id' => Schema::TYPE_INTEGER . ' NOT NULL', // here site is requaried
'offer_type_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'is_deleted' => Schema::TYPE_BOOLEAN . ' NOT NULL DEFAULT FALSE',
'is_active' => Schema::TYPE_BOOLEAN . ' NOT NULL DEFAULT TRUE',
'is_moderated' => Schema::TYPE_BOOLEAN . ' NOT NULL DEFAULT FALSE',
'is_success_vip' => Schema::TYPE_BOOLEAN . ' NOT NULL DEFAULT FALSE',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'url' => Schema::TYPE_STRING . '(255) DEFAULT NULL',
'price' => Schema::TYPE_MONEY . ' NOT NULL',
'price_type' => Schema::TYPE_INTEGER . ' NOT NULL',
'max_action_day' => Schema::TYPE_INTEGER . ' DEFAULT NULL',
'max_action' => Schema::TYPE_INTEGER . ' DEFAULT NULL',
'description' => Schema::TYPE_TEXT . '(4095) DEFAULT NULL',
'country_json' => 'json DEFAULT NULL',
'platform_json' => 'json DEFAULT NULL',
'created_time' => Schema::TYPE_TIMESTAMP . ' without time zone NOT NULL DEFAULT now()',
'changed_time' => Schema::TYPE_TIMESTAMP . ' without time zone NOT NULL DEFAULT now()',
'moderated_time' => Schema::TYPE_TIMESTAMP . ' without time zone NOT NULL DEFAULT now()',
]);
$this->addForeignKey('offer_site_id_fk', 'ads.offer', 'site_id', 'ads.site', 'id', 'NO ACTION', 'CASCADE');
$this->addForeignKey('offer_offer_type_id_fk', 'ads.offer', 'offer_type_id', 'ads.offer_type', 'id', 'NO ACTION', 'CASCADE');
}