hasTable('assistant_chat_sns')) { $schemaChanged = true; $table = $schema->createTable('assistant_chat_sns'); $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, ]); $table->addColumn('user_id', 'string', [ 'notnull' => true, 'length' => 256, ]); $table->addColumn('title', 'string', [ 'notnull' => false, 'length' => 256, ]); $table->addColumn('timestamp', Types::BIGINT, [ 'notnull' => true, 'unsigned' => true, ]); $table->setPrimaryKey(['id']); $table->addIndex(['user_id'], 'assistant_chat_ss_uid'); } if (!$schema->hasTable('assistant_chat_msgs')) { $schemaChanged = true; $table = $schema->createTable('assistant_chat_msgs'); $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, ]); $table->addColumn('session_id', Types::INTEGER, [ 'notnull' => true, ]); $table->addColumn('role', Types::STRING, [ 'length' => 256, ]); $table->addColumn('content', Types::TEXT, [ 'notnull' => true, ]); $table->addColumn('timestamp', Types::BIGINT, [ 'notnull' => true, 'unsigned' => true, ]); $table->setPrimaryKey(['id']); $table->addIndex(['session_id'], 'assistant_chat_ms_sid'); } return $schemaChanged ? $schema : null; } }