Closed fs-yuta-nakamura closed 8 months ago
--- spec/support/db/bankserve/Schemafile 2020-03-07 14:30:02.161461200 +0900 +++ ../zelda-bankserve/db/Schemafile 2020-03-06 01:13:35.397672600 +0900 @@ -155,25 +155,6 @@ t.index ["user_external_service_id"], name: "i_external_service_histories_on_user_ex_service_id", using: :btree end -create_table "offer_details", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| - t.integer "account_id", unsigned: true, null: false - t.integer "bank_offer_detail_id", null: false, unsigned: true - t.integer "offer_message_id", null: false, unsigned: true - t.integer "budget", null: false, default: 0, comment: "オファーに設定された予算" - t.integer "spending", null: false, default: 0, comment: "予算のうち、すでに使用された金額" - t.datetime "delivery_start_at", comment: "送信開始日時" - t.datetime "delivery_end_at", comment: "送信終了日時" - t.datetime "contact_info_start_at", null: false, comment: "個人情報保持開始日時" - t.datetime "contact_info_end_at", null: false, comment: "個人情報保持終了日時" - t.integer "status", null: false, unsigned: true, limit:1, default: 0, comment: "active: 0, spent: 1, canceled: 255" - t.string "notification_param" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["offer_message_id"], name: "index_offer_details_on_offer_message_id", using: :btree - t.index ["delivery_start_at"], name: "index_offer_details_on_delivery_start_at", using: :btree - t.index ["account_id", "bank_offer_detail_id"], name: "uniq_index_offer_details_on_acid_and_bodid", unique: true -end - create_table "offer_messages", primary_key: ["id", "created_at"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.bigint "id", null: false, comment: "ID", unsigned: true, auto_increment: true t.integer "account_id", unsigned: true, null: false @@ -190,7 +171,7 @@ t.bigint "id", null: false, comment: "ID", unsigned: true, auto_increment: true t.integer "account_id", null: false, unsigned: true t.integer "bank_mission_id", null: false, unsigned: true - t.integer "offer_message_id", null: false, unsigned: true + t.bigint "offer_message_id", null: false, unsigned: true t.integer "mission_type", null: false, default: 0, comment: "0: LP遷移, 1: 動画視聴, 2: 連絡先提供" t.integer "required_contact_type", limit: 1, comment: "0: メールアドレス, 1: 電話番号 2: LineID" t.string "lp_url" @@ -201,22 +182,8 @@ t.string "video_url" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["account_id", "bank_mission_id"], name: "index_missions_on_acc_id_and_bm_id", using: :btree - t.index ["offer_message_id"], name: "index_missions_on_offer_message_id", using: :btree -end - -create_table "mission_coins", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| - t.integer "account_id", null: false, unsigned: true - t.integer "bank_mission_coin_id", null: false, unsigned: true - t.integer "offer_detail_id", null: false, unsigned: true - t.integer "mission_id", null: false, unsigned: true - t.integer "coin", null: false, unsigned: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["offer_detail_id"], name: "index_mission_coins_on_offer_detail_id", using: :btree - t.index ["mission_id"], name: "index_mission_coins_on_mission_id", using: :btree - t.index ["offer_detail_id", "mission_id"], name: "uniq_index_mission_coins_on_odid_and_mid", unique: true - t.index ["account_id", "bank_mission_coin_id"], name: "index_mission_coins_on_acc_id_and_bmc_id", using: :btree, unique: true + t.index ["account_id", "bank_mission_id"], name: "index_missions_on_acc_id_and_bm_id", using: :btree + t.index ["offer_message_id"], name: "index_missions_on_offer_message_id", using: :btree end create_table "notification_settings", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| @@ -237,10 +204,8 @@ t.datetime "done_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["user_offer_message_id"], name: "index_user_missions_on_ufm_id", using: :btree t.index ["mission_id"], name: "index_user_missions_on_mission_id", using: :btree t.index ["user_id"], name: "index_user_missions_on_user_id", using: :btree - t.index ["user_id", "mission_id"], name: "uniq_index_user_missions_on_uid_and_mid", unique: true end create_table "sevennet_transactions", id: :bigint, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| @@ -248,13 +213,11 @@ t.string "email", null: false t.integer "coin_consumed", unsigned: true, null: false t.integer "yen_acquired", unsigned: true, null: false - t.integer "status", null: false, default: 0, comment: "ステータス(0: 未処理, 1:csv出力済み)" t.integer "coin_history_id", unsigned: true, null: false t.integer "bank_sevennet_export_id", unsigned: true t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["coin_history_id"], name: "index_coin_histories_on_coin_history_id", using: :btree - t.index ["user_id"], name: "index_coin_histories_on_user_id", using: :btree end create_table "users", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| @@ -269,12 +232,12 @@ end create_table "user_device_tokens", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| - t.integer "user_id", null: false, unsigned: true - t.string "device_token", null: false - t.string "uuid", null: false - t.integer "device_os", null: false, comment: "デバイスのOS(1:android, 2:ios)" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id", unsigned: true, null: false + t.string "device_token" + t.string "uuid", null: false + t.integer "device_os", comment: "デバイスのOS(1:android, 2:ios)" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["user_id"], name: "index_user_messages_on_user_id", using: :btree end @@ -282,7 +245,7 @@ t.bigint "id", null: false, comment: "ID", unsigned: true, auto_increment: true t.integer "user_id", unsigned: true, null: false t.integer "offer_message_id", unsigned: true, null: false - t.integer "offer_detail_id", unsigned: true + t.integer "bank_offer_detail_id", unsigned: true t.boolean "hidden", null: false, default: false, comment: "非表示フラグ。trueの場合、オファー表示しない。" t.integer "status", default: 0, comment: "メッセージステータス(0:未読, 1:既読, 255: キャンセル)" t.datetime "expired_at" @@ -292,7 +255,6 @@ t.datetime "updated_at", null: false t.index ["user_id"], name: "index_user_offer_messages_on_user_id", using: :btree t.index ["offer_message_id"], name: "index_user_offer_messages_on_message_id", using: :btree - t.index ["user_id", "offer_message_id"], name: "uniq_index_user_offer_messages_on_uid_and_omid", unique: true end create_table "user_profiles", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| @@ -351,6 +313,29 @@ t.index ["account_id"], name: "index_companies_on_account_id", using: :btree end +create_table "offer_details", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| + t.integer "account_id", null: false, unsigned: true, comment: "アカウントID" + t.integer "data_view_id", null: false, unsigned: true + t.integer "target_id", null: false, unsigned: true + t.integer "offer_message_id", null: false, unsigned: true + t.integer "budget", null: false, default: 0, comment: "オファーに設定された予算" + t.integer "spending", null: false, default: 0, comment: "予算のうち、すでに使用された金額" + t.datetime "delivery_start_at", comment: "送信開始日時" + t.datetime "delivery_end_at", comment: "送信終了日時" + t.datetime "contact_info_start_at", null: false, comment: "個人情報保持開始日時" + t.datetime "contact_info_end_at", null: false, comment: "個人情報保持終了日時" + t.integer "status", null: false, unsigned: true, limit:1, default: 0, comment: "active: 0, spent: 1, canceled: 255" + t.string "notification_param" + t.bigint "created_by", null: false, comment: "設定作成者" + t.bigint "updated_by", null: false, comment: "設定更新者" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["data_view_id"], name: "index_offer_details_on_data_view_id", using: :btree + t.index ["target_id"], name: "index_offer_details_on_target_id", using: :btree + t.index ["offer_message_id"], name: "index_offer_details_on_offer_message_id", using: :btree + t.index ["delivery_start_at"], name: "index_offer_details_on_delivery_start_at", using: :btree +end + create_table "welcome_offers", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "offer_message_id", null: false, unsigned: true, unique: true t.integer "status", null: false, default: 0, comment: "ステータス(0: 有効, 1:無効)" @@ -371,3 +356,11 @@ t.index ["welcome_offer_id"], name: "index_welcome_missions_on_welcome_offer_id", using: :btree t.index ["mission_id"], name: "index_welcome_missions_on_mission_id", using: :btree end + +add_foreign_key "offer_details", "offer_messages", name: "fk_offer_details_on_offer_message_id" +add_foreign_key "missions", "offer_messages", name: "fk_missios_on_offer_message_id" +add_foreign_key "user_offer_messages", "offer_messages", name: "fk_user_offer_messages_on_offer_message_id" +add_foreign_key "user_missions", "missions", name: "fk_user_offer_messages_on_offer_message_id" +# add_foreign_key "user_offer_messages", "offer_details", name: "fk_user_offer_messages_on_offer_detail_id" + +require 'Schemafile_partition'