ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 11553


Ignore:
Timestamp:
Apr 30, 2009, 7:31:22 PM (13 years ago)
Author:
fukamachi
Message:

DBコンバータ - messageテーブルへの変換に対応

Location:
OpenPNE/branches/work/fukamachi/db_converter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/fukamachi/db_converter/db_converter.php

    r11552 r11553  
    368368    return sql_add_increment_column($result, $sql['table'], $sql['column'], 1);
    369369}
     370
     371function table_message_sql($dbh, $sql)
     372{
     373    $result = $dbh->query($sql['sql']);
     374
     375    $message = array();
     376
     377    while ($row = $result->fetchRow()) {
     378        $row[6] = _get_thread_message_id($row[7]);
     379        array_push($message, $row);
     380    }
     381
     382    return generate_insert_sql_with_array($message, $sql['table'], $sql['column']);
     383
     384    function _get_thread_message_id($dbh, $message_id)
     385    {
     386        $res = $dbh->query("SELECT hensinmoto_c_message_id FROM c_message WHERE c_message_id = $message_id");
     387        $row = $res->fetchRow();
     388        if (!$row[0]) {
     389            return $message_id;
     390        }
     391        return _get_thread_message_id($dbh, $row[0]);
     392    }
     393}
    370394?>
  • OpenPNE/branches/work/fukamachi/db_converter/db_relation.yml

    r11552 r11553  
    135135- table: deleted_message
    136136   #!!!message_send_list_id
    137   column: [member_id, message_id, is_deleted, created_at]
     137  column: [id, member_id, message_id, message_send_list_id, is_deleted, created_at, updated_at]
    138138  sql: >
    139139    SELECT
     
    436436
    437437- table: message
    438    #!!!thread_message_id
    439    #!!!message_type_id
    440   column: [id, member_id, subject, body, is_deleted, is_send, return_message_id, message_type_id, created_at]
     438  special: 1
     439  column: [id, member_id, subject, body, is_deleted, is_send, thread_message_id, return_message_id, message_type_id, created_at, updated_at]
    441440  sql: >
    442441    SELECT
     
    447446        is_deleted_from as is_deleted,
    448447        is_send,
     448        NULL as thread_message_id,
    449449        hensinmoto_c_message_id as return_message_id,
    450450        2 as message_type_id,
    451         r_datetime as created_at
     451        r_datetime as created_at,
     452        r_datetime as updated_at
    452453    FROM c_message
    453454
Note: See TracChangeset for help on using the changeset viewer.