#!/usr/bin/env ruby
require File.expand_path('../../../config/environment', __FILE__)
ForeignKey.disabled

Swars::Battle.destroy_all
Swars::User.destroy_all

user1 = Swars::User.create!
user2 = Swars::User.create!

2.times do
  Swars::Battle.create! do |e|
    e.memberships.build(user: user1)
    e.memberships.build(user: user2)
  end
  Swars::Battle.create! do |e|
    e.memberships.build(user: user2)
    e.memberships.build(user: user1)
  end
end

tp Swars::User
tp Swars::Membership

# >> |----+----------+----------+-------------------+-------------------+---------------------------+---------------------------|
# >> | id | user_key | grade_id | last_reception_at | search_logs_count | created_at                | updated_at                |
# >> |----+----------+----------+-------------------+-------------------+---------------------------+---------------------------|
# >> | 33 | user1    |       40 |                   |                 0 | 2022-03-06 13:28:39 +0900 | 2022-03-06 13:28:40 +0900 |
# >> | 34 | user2    |       40 |                   |                 0 | 2022-03-06 13:28:39 +0900 | 2022-03-06 13:28:40 +0900 |
# >> |----+----------+----------+-------------------+-------------------+---------------------------+---------------------------|
# >> |-----+-----------+---------+------------+----------+-----------+--------------+----------+------------+---------------------------+---------------------------+---------------+---------------+----------------+------------+-----------+---------------+--------------+------------------+-----------------+--------------------+---------------+----------------|
# >> | id  | battle_id | user_id | op_user_id | grade_id | judge_key | location_key | position | grade_diff | created_at                | updated_at                | think_all_avg | think_end_avg | two_serial_max | think_last | think_max | obt_think_avg | ai_drop_total | defense_tag_list | attack_tag_list | technique_tag_list | note_tag_list | other_tag_list |
# >> |-----+-----------+---------+------------+----------+-----------+--------------+----------+------------+---------------------------+---------------------------+---------------+---------------+----------------+------------+-----------+---------------+--------------+------------------+-----------------+--------------------+---------------+----------------|
# >> | 781 |       391 |      33 |         34 |       40 | win       | black        |        0 |          0 | 2022-03-06 13:28:39 +0900 | 2022-03-06 13:28:39 +0900 |             2 |             2 |              1 |          2 |         5 |               |              |                  |                 |                    |               |                |
# >> | 782 |       391 |      34 |         33 |       40 | lose      | white        |        1 |          0 | 2022-03-06 13:28:39 +0900 | 2022-03-06 13:28:39 +0900 |             5 |             5 |                |          7 |         7 |               |              |                  |                 |                    |               |                |
# >> | 783 |       392 |      34 |         33 |       40 | win       | black        |        0 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             2 |             2 |              1 |          2 |         5 |               |              |                  |                 |                    |               |                |
# >> | 784 |       392 |      33 |         34 |       40 | lose      | white        |        1 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             5 |             5 |                |          7 |         7 |               |              |                  |                 |                    |               |                |
# >> | 785 |       393 |      33 |         34 |       40 | win       | black        |        0 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             2 |             2 |              1 |          2 |         5 |               |              |                  |                 |                    |               |                |
# >> | 786 |       393 |      34 |         33 |       40 | lose      | white        |        1 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             5 |             5 |                |          7 |         7 |               |              |                  |                 |                    |               |                |
# >> | 787 |       394 |      34 |         33 |       40 | win       | black        |        0 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             2 |             2 |              1 |          2 |         5 |               |              |                  |                 |                    |               |                |
# >> | 788 |       394 |      33 |         34 |       40 | lose      | white        |        1 |          0 | 2022-03-06 13:28:40 +0900 | 2022-03-06 13:28:40 +0900 |             5 |             5 |                |          7 |         7 |               |              |                  |                 |                    |               |                |
# >> |-----+-----------+---------+------------+----------+-----------+--------------+----------+------------+---------------------------+---------------------------+---------------+---------------+----------------+------------+-----------+---------------+--------------+------------------+-----------------+--------------------+---------------+----------------|
