// administrators $this->createTable('{{%administrators}}', [ 'id' => Schema::TYPE_INTEGER . "(11) NOT NULL", 'member_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'name' => Schema::TYPE_STRING . "(45) NULL", 'email' => Schema::TYPE_STRING . "(45) NULL", 'created' => Schema::TYPE_DATETIME . " NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // api_clients $this->createTable('{{%api_clients}}', [ 'id' => Schema::TYPE_STRING . "(40) NOT NULL", 'name' => Schema::TYPE_STRING . "(150) NOT NULL", 'api_secret' => Schema::TYPE_STRING . "(32) NOT NULL", 'origin_url' => Schema::TYPE_STRING . "(255) NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // api_sessions $this->createTable('{{%api_sessions}}', [ 'profile_id' => Schema::TYPE_INTEGER . "(10) NOT NULL", 'client_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'token' => Schema::TYPE_STRING . "(40) NOT NULL", 'time_start' => Schema::TYPE_DOUBLE . " NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (profile_id, client_id)', ], $this->tableOptions); // applications $this->createTable('{{%applications}}', [ 'id' => Schema::TYPE_BIGPK, 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'description' => Schema::TYPE_STRING . "(150) NULL", 'source' => Schema::TYPE_TEXT . " NULL", 'html' => Schema::TYPE_TEXT . " NULL", 'styles' => Schema::TYPE_TEXT . " NULL", 'image' => Schema::TYPE_STRING . "(255) NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'created_by' => Schema::TYPE_STRING . "(45) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // applications_config $this->createTable('{{%applications_config}}', [ 'application_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'application_param' => Schema::TYPE_STRING . "(45) NOT NULL", 'application_value' => Schema::TYPE_STRING . "(45) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (application_id)', ], $this->tableOptions); // applications_versions $this->createTable('{{%applications_versions}}', [ 'id' => Schema::TYPE_BIGPK, 'application_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'description' => Schema::TYPE_STRING . "(150) NULL", 'source' => Schema::TYPE_TEXT . " NULL", 'html' => Schema::TYPE_TEXT . " NULL", 'styles' => Schema::TYPE_TEXT . " NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'created_by' => Schema::TYPE_STRING . "(45) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // customer_application_config $this->createTable('{{%customer_application_config}}', [ 'id' => Schema::TYPE_BIGPK, 'installation_id' => Schema::TYPE_BIGINT . "(20) UNSIGNED NOT NULL", 'application_param' => Schema::TYPE_STRING . "(45) NOT NULL", 'application_value' => Schema::TYPE_STRING . "(45) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // customer_devices $this->createTable('{{%customer_devices}}', [ 'customer_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'device_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (customer_id, device_id)', ], $this->tableOptions); // customer_installations $this->createTable('{{%customer_installations}}', [ 'id' => Schema::TYPE_BIGINT . "(20) UNSIGNED NOT NULL AUTO_INCREMENT", 'customer_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'version_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'device_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'active' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // customers $this->createTable('{{%customers}}', [ 'id' => Schema::TYPE_BIGPK, 'member_id' => Schema::TYPE_STRING . "(40) NULL", 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // developers $this->createTable('{{%developers}}', [ 'id' => Schema::TYPE_BIGPK, 'member_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // deviceType $this->createTable('{{%deviceType}}', [ 'id' => Schema::TYPE_INTEGER . "(10) UNSIGNED NOT NULL AUTO_INCREMENT", 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // devices $this->createTable('{{%devices}}', [ 'id' => Schema::TYPE_BIGPK, 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'deviceType_id' => Schema::TYPE_INTEGER . "(10) UNSIGNED NULL", 'customer_id' => Schema::TYPE_BIGINT . "(20) NOT NULL", 'serialNumber' => Schema::TYPE_STRING . "(40) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0'", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // ec_mm_group_permissions $this->createTable('{{%ec_mm_group_permissions}}', [ 'ec_mm_groups_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'ec_mm_persmission_id' => Schema::TYPE_INTEGER . "(11) UNSIGNED NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (ec_mm_groups_id, ec_mm_persmission_id)', ], $this->tableOptions); // ec_mm_groups $this->createTable('{{%ec_mm_groups}}', [ 'id' => Schema::TYPE_STRING . "(40) NOT NULL", 'name' => Schema::TYPE_STRING . "(45) NOT NULL", 'description' => Schema::TYPE_STRING . "(150) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(45) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // ec_mm_member_groups $this->createTable('{{%ec_mm_member_groups}}', [ 'ec_mm_members_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'ec_mm_groups_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (ec_mm_members_id, ec_mm_groups_id)', ], $this->tableOptions); // ec_mm_members $this->createTable('{{%ec_mm_members}}', [ 'id' => Schema::TYPE_STRING . "(40) NOT NULL", 'user' => Schema::TYPE_STRING . "(45) NOT NULL", 'pass' => Schema::TYPE_STRING . "(100) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // ec_mm_permissions $this->createTable('{{%ec_mm_permissions}}', [ 'id' => Schema::TYPE_INTEGER . "(11) UNSIGNED NOT NULL AUTO_INCREMENT", 'name' => Schema::TYPE_STRING . "(10) NULL", 'description' => Schema::TYPE_STRING . "(45) NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // ec_soc_actions $this->createTable('{{%ec_soc_actions}}', [ 'id' => Schema::TYPE_INTEGER . "(10) UNSIGNED NOT NULL AUTO_INCREMENT", 'name' => Schema::TYPE_STRING . "(50) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // ec_soc_entities $this->createTable('{{%ec_soc_entities}}', [ 'id' => Schema::TYPE_INTEGER . "(10) UNSIGNED NOT NULL AUTO_INCREMENT", 'name' => Schema::TYPE_STRING . "(20) NOT NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // ec_soc_likes $this->createTable('{{%ec_soc_likes}}', [ 'id' => Schema::TYPE_BIGINT . "(20) UNSIGNED NOT NULL AUTO_INCREMENT", 'member_id' => Schema::TYPE_STRING . "(40) NOT NULL", 'entities_id' => Schema::TYPE_INTEGER . "(11) NOT NULL", 'entity_type_id' => Schema::TYPE_INTEGER . "(11) UNSIGNED NOT NULL", 'action_id' => Schema::TYPE_INTEGER . "(10) UNSIGNED NOT NULL COMMENT '1=like; 2=dislike'", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", 'PRIMARY KEY (id)', ], $this->tableOptions); // files $this->createTable('{{%files}}', [ 'id' => Schema::TYPE_PK, 'name' => Schema::TYPE_STRING . "(45) NULL", 'nameFile' => Schema::TYPE_STRING . "(250) NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // trackdata $this->createTable('{{%trackdata}}', [ 'id' => Schema::TYPE_BIGPK, 'InstalationId' => Schema::TYPE_BIGINT . "(20) NULL", 'TrackedUser' => Schema::TYPE_STRING . "(50) NULL", 'PosX' => Schema::TYPE_FLOAT . " NULL", 'PosY' => Schema::TYPE_FLOAT . " NULL", 'PosZ' => Schema::TYPE_FLOAT . " NULL", 'TrackDate' => Schema::TYPE_DATETIME . " NULL", 'created' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT CURRENT_TIMESTAMP", 'createdBy' => Schema::TYPE_STRING . "(40) NULL", 'updated' => Schema::TYPE_TIMESTAMP . " NULL", 'updatedBy' => Schema::TYPE_STRING . "(40) NULL", ], $this->tableOptions); // fk: administrators $this->addForeignKey('fk_administrators_member_id', '{{%administrators}}', 'member_id', '{{%ec_mm_members}}', 'id'); // fk: applications_versions $this->addForeignKey('fk_applications_versions_application_id', '{{%applications_versions}}', 'application_id', '{{%applications}}', 'id'); // fk: customer_application_config $this->addForeignKey('fk_customer_application_config_installation_id', '{{%customer_application_config}}', 'installation_id', '{{%customer_installations}}', 'id'); // fk: customer_devices $this->addForeignKey('fk_customer_devices_customer_id', '{{%customer_devices}}', 'customer_id', '{{%customers}}', 'id'); $this->addForeignKey('fk_customer_devices_device_id', '{{%customer_devices}}', 'device_id', '{{%devices}}', 'id'); // fk: customer_installations $this->addForeignKey('fk_customer_installations_version_id', '{{%customer_installations}}', 'version_id', '{{%applications_versions}}', 'id'); $this->addForeignKey('fk_customer_installations_customer_id', '{{%customer_installations}}', 'customer_id', '{{%customers}}', 'id'); $this->addForeignKey('fk_customer_installations_device_id', '{{%customer_installations}}', 'device_id', '{{%devices}}', 'id'); // fk: developers $this->addForeignKey('fk_developers_member_id', '{{%developers}}', 'member_id', '{{%ec_mm_members}}', 'id'); // fk: devices $this->addForeignKey('fk_devices_deviceType_id', '{{%devices}}', 'deviceType_id', '{{%deviceType}}', 'id'); // fk: ec_soc_likes $this->addForeignKey('fk_ec_soc_likes_action_id', '{{%ec_soc_likes}}', 'action_id', '{{%ec_soc_actions}}', 'id'); $this->addForeignKey('fk_ec_soc_likes_entity_type_id', '{{%ec_soc_likes}}', 'entity_type_id', '{{%ec_soc_entities}}', 'id');