# frozen_string_literal: true

require 'active_record'
require 'sequel'

db_path = File.expand_path('db/test.sqlite3', __dir__)

# Activerecord initializer
# No logs in test
# ActiveRecord::Base.logger = Logger.new($stdout)
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: db_path)

## Sequel initializer
Sequel.default_timezone = :utc
DB = Sequel.connect(adapter: 'sqlite', user: 'root', password: 'password',
                    host: 'localhost', port: '3306', database: db_path)

# Models
class Event < ActiveRecord::Base
end

class Event40 < ActiveRecord::Base
end

class Pet < ActiveRecord::Base
end

# :nocov:
if ENV['REBUILD_TEST_DB']

  ActiveRecord::Schema.define do
    create_table :events, force: true do |t|
      t.string :title
      t.timestamp :time
    end
    create_table :event40s, force: true do |t|
      t.string :title
      t.timestamp :time
    end
    create_table :pets, force: true do |t|
      t.string :name
      t.string :animal
      t.date :birthdate
    end
  end

  TIMES = <<~TIMES
    2021-10-21 13:18:23 +0000
    2021-10-21 23:14:50 +0000
    2021-10-23 01:06:02 +0000
    2021-10-25 18:54:35 +0000
    2021-10-26 02:22:17 +0000
    2021-10-28 22:59:49 +0000
    2021-10-30 15:02:25 +0000
    2021-11-02 04:03:39 +0000
    2021-11-04 22:41:23 +0000
    2021-11-06 00:34:29 +0000
    2021-11-06 23:56:16 +0000
    2021-11-07 06:22:04 +0000
    2021-11-07 19:46:08 +0000
    2021-11-08 09:31:13 +0000
    2021-11-09 17:22:03 +0000
    2021-11-11 05:29:54 +0000
    2021-11-13 09:41:04 +0000
    2021-11-16 07:48:22 +0000
    2021-11-16 12:43:44 +0000
    2021-11-17 16:03:07 +0000
    2021-11-20 02:39:01 +0000
    2021-11-21 02:01:24 +0000
    2021-11-23 19:24:43 +0000
    2021-11-26 11:47:22 +0000
    2021-11-28 06:30:04 +0000
    2021-12-01 00:13:55 +0000
    2021-12-03 19:10:16 +0000
    2021-12-04 00:43:47 +0000
    2021-12-06 20:15:35 +0000
    2021-12-09 16:27:07 +0000
    2021-12-10 15:28:48 +0000
    2021-12-10 23:08:16 +0000
    2021-12-11 23:09:08 +0000
    2021-12-14 04:56:58 +0000
    2021-12-14 14:00:56 +0000
    2021-12-15 22:58:51 +0000
    2021-12-16 01:28:21 +0000
    2021-12-16 20:16:54 +0000
    2021-12-19 00:34:04 +0000
    2021-12-19 06:58:41 +0000
    2021-12-21 11:13:53 +0000
    2021-12-23 07:28:50 +0000
    2021-12-23 07:57:58 +0000
    2021-12-23 18:32:13 +0000
    2021-12-24 01:17:51 +0000
    2021-12-25 05:36:16 +0000
    2021-12-25 23:21:57 +0000
    2021-12-27 12:18:57 +0000
    2021-12-28 16:59:57 +0000
    2021-12-31 15:10:23 +0000
    2022-01-01 19:18:06 +0000
    2022-01-03 08:36:27 +0000
    2022-01-03 23:31:01 +0000
    2022-01-05 02:14:57 +0000
    2022-01-06 09:26:03 +0000
    2022-01-07 20:22:22 +0000
    2022-01-10 04:04:28 +0000
    2022-01-11 17:17:55 +0000
    2022-01-14 05:21:54 +0000
    2022-01-16 01:18:58 +0000
    2022-01-18 08:42:56 +0000
    2022-01-19 00:45:04 +0000
    2022-01-20 08:18:54 +0000
    2022-01-22 05:26:38 +0000
    2022-01-24 10:57:50 +0000
    2022-01-26 09:47:02 +0000
    2022-01-28 20:44:30 +0000
    2022-01-31 16:19:50 +0000
    2022-02-01 21:23:58 +0000
    2022-02-04 14:41:57 +0000
    2022-02-06 20:40:06 +0000
    2022-02-07 23:03:50 +0000
    2022-02-09 05:28:08 +0000
    2022-02-10 02:19:12 +0000
    2022-02-11 07:51:30 +0000
    2022-02-12 13:46:16 +0000
    2022-02-13 21:06:40 +0000
    2022-02-15 11:37:50 +0000
    2022-02-18 11:23:15 +0000
    2022-02-20 08:01:49 +0000
    2022-02-23 03:00:30 +0000
    2022-02-24 21:52:25 +0000
    2022-02-25 12:07:56 +0000
    2022-02-27 04:20:20 +0000
    2022-02-28 21:09:42 +0000
    2022-03-02 23:35:41 +0000
    2022-03-04 00:42:10 +0000
    2022-03-05 00:59:10 +0000
    2022-03-06 19:58:01 +0000
    2022-03-07 07:48:09 +0000
    2022-03-09 06:08:00 +0000
    2022-03-10 05:45:08 +0000
    2022-03-12 21:16:31 +0000
    2022-03-15 08:17:44 +0000
    2022-03-16 03:37:03 +0000
    2022-03-18 05:07:54 +0000
    2022-03-20 04:05:26 +0000
    2022-03-22 10:52:33 +0000
    2022-03-23 15:26:54 +0000
    2022-03-24 09:01:04 +0000
    2022-03-24 23:53:07 +0000
    2022-03-27 13:45:17 +0000
    2022-03-28 19:57:00 +0000
    2022-03-29 15:42:35 +0000
    2022-03-29 18:20:32 +0000
    2022-04-01 15:35:47 +0000
    2022-04-02 06:33:31 +0000
    2022-04-03 18:27:19 +0000
    2022-04-03 23:44:08 +0000
    2022-04-06 10:59:32 +0000
    2022-04-07 01:33:53 +0000
    2022-04-08 10:26:34 +0000
    2022-04-10 19:21:08 +0000
    2022-04-12 01:50:04 +0000
    2022-04-14 19:56:29 +0000
    2022-04-15 09:08:22 +0000
    2022-04-16 07:58:47 +0000
    2022-04-17 16:31:40 +0000
    2022-04-20 09:50:22 +0000
    2022-04-23 04:24:22 +0000
    2022-04-25 07:18:04 +0000
    2022-04-27 16:57:48 +0000
    2022-04-29 18:48:09 +0000
    2022-04-29 20:30:25 +0000
    2022-05-02 03:44:25 +0000
    2022-05-03 15:27:57 +0000
    2022-05-04 08:11:15 +0000
    2022-05-07 00:42:14 +0000
    2022-05-09 15:23:31 +0000
    2022-05-10 19:11:49 +0000
    2022-05-11 14:04:17 +0000
    2022-05-14 12:09:34 +0000
    2022-05-15 13:31:54 +0000
    2022-05-17 21:21:37 +0000
    2022-05-19 01:27:43 +0000
    2022-05-21 04:34:59 +0000
    2022-05-23 11:05:18 +0000
    2022-05-23 19:14:50 +0000
    2022-05-26 13:16:18 +0000
    2022-05-27 11:39:35 +0000
    2022-05-29 07:09:07 +0000
    2022-05-30 15:13:23 +0000
    2022-06-01 04:18:40 +0000
    2022-06-01 11:11:51 +0000
    2022-06-01 12:45:06 +0000
    2022-06-03 07:08:31 +0000
    2022-06-04 23:28:11 +0000
    2022-06-07 12:14:01 +0000
    2022-06-08 13:32:22 +0000
    2022-06-10 18:56:37 +0000
    2022-06-12 16:00:09 +0000
    2022-06-15 13:28:55 +0000
    2022-06-16 18:42:37 +0000
    2022-06-17 00:36:21 +0000
    2022-06-18 16:21:27 +0000
    2022-06-20 13:50:27 +0000
    2022-06-22 09:43:55 +0000
    2022-06-25 09:43:17 +0000
    2022-06-27 06:51:01 +0000
    2022-06-28 09:10:53 +0000
    2022-06-30 18:46:16 +0000
    2022-07-01 16:05:14 +0000
    2022-07-02 14:02:12 +0000
    2022-07-05 11:08:11 +0000
    2022-07-05 12:44:38 +0000
    2022-07-08 03:55:17 +0000
    2022-07-08 18:02:14 +0000
    2022-07-09 09:41:17 +0000
    2022-07-11 07:34:51 +0000
    2022-07-13 05:11:19 +0000
    2022-07-15 02:46:56 +0000
    2022-07-16 15:40:39 +0000
    2022-07-17 19:44:15 +0000
    2022-07-19 00:31:12 +0000
    2022-07-21 21:58:24 +0000
    2022-07-22 05:25:48 +0000
    2022-07-22 18:33:04 +0000
    2022-07-24 07:42:24 +0000
    2022-07-25 07:21:20 +0000
    2022-07-27 12:02:44 +0000
    2022-07-29 03:29:28 +0000
    2022-07-29 11:35:43 +0000
    2022-07-30 05:25:21 +0000
    2022-07-30 19:39:10 +0000
    2022-07-31 18:54:58 +0000
    2022-08-03 11:18:44 +0000
    2022-08-05 00:37:47 +0000
    2022-08-05 12:08:08 +0000
    2022-08-07 14:39:19 +0000
    2022-08-08 09:52:59 +0000
    2022-08-09 13:48:29 +0000
    2022-08-11 19:03:04 +0000
    2022-08-13 01:56:49 +0000
    2022-08-15 11:33:09 +0000
    2022-08-17 23:37:45 +0000
    2022-08-19 00:47:19 +0000
    2022-08-19 01:01:12 +0000
    2022-08-21 07:37:55 +0000
    2022-08-21 21:42:15 +0000
    2022-08-23 10:55:39 +0000
    2022-08-25 16:20:29 +0000
    2022-08-27 06:28:14 +0000
    2022-08-27 13:12:57 +0000
    2022-08-28 23:00:13 +0000
    2022-08-31 05:19:56 +0000
    2022-09-02 18:00:18 +0000
    2022-09-04 12:02:47 +0000
    2022-09-06 00:57:21 +0000
    2022-09-08 04:26:01 +0000
    2022-09-09 04:55:45 +0000
    2022-09-11 22:59:36 +0000
    2022-09-12 00:54:25 +0000
    2022-09-12 17:44:24 +0000
    2022-09-12 20:47:30 +0000
    2022-09-15 11:39:20 +0000
    2022-09-16 07:54:15 +0000
    2022-09-17 08:06:29 +0000
    2022-09-18 07:17:17 +0000
    2022-09-19 08:39:55 +0000
    2022-09-22 06:32:56 +0000
    2022-09-22 21:26:29 +0000
    2022-09-24 16:06:50 +0000
    2022-09-27 05:50:18 +0000
    2022-09-28 12:12:13 +0000
    2022-09-29 21:13:01 +0000
    2022-09-30 00:09:29 +0000
    2022-10-02 04:35:07 +0000
    2022-10-02 16:30:20 +0000
    2022-10-04 10:35:59 +0000
    2022-10-04 23:39:37 +0000
    2022-10-07 23:25:10 +0000
    2022-10-08 20:31:14 +0000
    2022-10-09 07:30:41 +0000
    2022-10-11 07:29:41 +0000
    2022-10-11 08:00:58 +0000
    2022-10-14 03:22:26 +0000
    2022-10-16 14:47:54 +0000
    2022-10-17 00:28:32 +0000
    2022-10-19 10:46:33 +0000
    2022-10-21 02:39:31 +0000
    2022-10-21 19:24:24 +0000
    2022-10-23 05:38:26 +0000
    2022-10-25 13:28:28 +0000
    2022-10-26 20:26:31 +0000
    2022-10-29 12:43:40 +0000
    2022-10-31 11:21:43 +0000
    2022-11-03 04:42:32 +0000
    2022-11-04 20:26:28 +0000
    2022-11-05 15:08:01 +0000
    2022-11-06 10:55:38 +0000
    2022-11-07 04:13:28 +0000
    2022-11-08 03:42:59 +0000
    2022-11-10 13:56:10 +0000
    2022-11-13 13:01:38 +0000
    2022-11-15 02:04:32 +0000
    2022-11-17 09:10:48 +0000
    2022-11-19 11:37:01 +0000
    2022-11-20 06:15:33 +0000
    2022-11-22 08:35:41 +0000
    2022-11-24 20:42:50 +0000
    2022-11-25 17:45:48 +0000
    2022-11-28 06:16:15 +0000
    2022-11-28 18:12:24 +0000
    2022-11-30 20:09:46 +0000
    2022-12-01 03:29:43 +0000
    2022-12-02 03:58:02 +0000
    2022-12-02 19:47:06 +0000
    2022-12-04 14:54:02 +0000
    2022-12-06 02:22:58 +0000
    2022-12-06 09:29:06 +0000
    2022-12-06 17:16:19 +0000
    2022-12-09 14:10:12 +0000
    2022-12-11 19:54:41 +0000
    2022-12-11 23:48:45 +0000
    2022-12-12 12:05:28 +0000
    2022-12-12 21:37:48 +0000
    2022-12-15 05:08:10 +0000
    2022-12-16 19:06:39 +0000
    2022-12-18 21:49:36 +0000
    2022-12-20 00:54:09 +0000
    2022-12-22 21:51:31 +0000
    2022-12-25 08:40:02 +0000
    2022-12-26 22:01:45 +0000
    2022-12-29 18:46:07 +0000
    2023-01-01 01:55:31 +0000
    2023-01-01 17:34:53 +0000
    2023-01-04 09:05:13 +0000
    2023-01-05 01:57:33 +0000
    2023-01-06 08:56:47 +0000
    2023-01-07 18:52:12 +0000
    2023-01-08 00:43:40 +0000
    2023-01-10 13:28:23 +0000
    2023-01-13 10:22:38 +0000
    2023-01-15 01:43:06 +0000
    2023-01-15 04:30:52 +0000
    2023-01-16 23:13:04 +0000
    2023-01-19 17:16:31 +0000
    2023-01-21 09:25:58 +0000
    2023-01-23 09:42:42 +0000
    2023-01-24 11:13:59 +0000
    2023-01-25 00:57:26 +0000
    2023-01-27 10:31:18 +0000
    2023-01-28 07:08:54 +0000
    2023-01-28 09:46:16 +0000
    2023-01-30 04:34:32 +0000
    2023-01-30 05:30:26 +0000
    2023-01-31 08:08:44 +0000
    2023-02-03 01:02:02 +0000
    2023-02-03 10:02:38 +0000
    2023-02-05 02:22:53 +0000
    2023-02-05 05:55:46 +0000
    2023-02-07 06:18:28 +0000
    2023-02-08 13:57:28 +0000
    2023-02-08 17:53:12 +0000
    2023-02-10 08:40:27 +0000
    2023-02-10 10:28:23 +0000
    2023-02-12 15:42:42 +0000
    2023-02-14 06:11:35 +0000
    2023-02-14 12:22:06 +0000
    2023-02-16 14:43:29 +0000
    2023-02-16 15:58:19 +0000
    2023-02-17 08:36:37 +0000
    2023-02-19 04:20:36 +0000
    2023-02-21 03:27:07 +0000
    2023-02-22 09:09:23 +0000
    2023-02-24 10:19:14 +0000
    2023-02-26 13:28:50 +0000
    2023-02-27 15:33:38 +0000
    2023-03-01 14:48:42 +0000
    2023-03-02 19:17:52 +0000
    2023-03-03 09:48:41 +0000
    2023-03-04 12:44:18 +0000
    2023-03-06 18:24:47 +0000
    2023-03-09 13:55:36 +0000
    2023-03-11 13:50:26 +0000
    2023-03-14 05:57:47 +0000
    2023-03-14 09:16:38 +0000
    2023-03-14 12:34:22 +0000
    2023-03-14 15:15:53 +0000
    2023-03-16 18:34:04 +0000
    2023-03-19 13:01:38 +0000
    2023-03-19 15:24:32 +0000
    2023-03-20 14:56:28 +0000
    2023-03-21 12:32:45 +0000
    2023-03-23 22:16:22 +0000
    2023-03-24 01:05:24 +0000
    2023-03-26 12:01:36 +0000
    2023-03-29 07:45:17 +0000
    2023-04-01 06:03:31 +0000
    2023-04-02 20:45:43 +0000
    2023-04-03 05:33:10 +0000
    2023-04-03 16:15:11 +0000
    2023-04-05 14:56:49 +0000
    2023-04-06 22:21:46 +0000
    2023-04-08 19:50:51 +0000
    2023-04-09 06:14:30 +0000
    2023-04-09 11:26:27 +0000
    2023-04-11 21:34:04 +0000
    2023-04-14 08:51:06 +0000
    2023-04-16 15:58:05 +0000
    2023-04-17 03:06:43 +0000
    2023-04-18 16:28:30 +0000
    2023-04-18 17:32:38 +0000
    2023-04-19 20:34:45 +0000
    2023-04-22 06:16:01 +0000
    2023-04-22 12:00:25 +0000
    2023-04-24 21:12:27 +0000
    2023-04-27 15:19:36 +0000
    2023-04-29 00:43:46 +0000
    2023-04-29 17:50:02 +0000
    2023-04-30 05:22:14 +0000
    2023-05-01 07:20:17 +0000
    2023-05-03 05:11:16 +0000
    2023-05-05 00:13:31 +0000
    2023-05-05 12:08:33 +0000
    2023-05-05 16:26:19 +0000
    2023-05-07 23:53:00 +0000
    2023-05-10 17:41:27 +0000
    2023-05-12 01:37:24 +0000
    2023-05-14 08:18:36 +0000
    2023-05-16 15:17:43 +0000
    2023-05-16 18:24:55 +0000
    2023-05-19 16:16:45 +0000
    2023-05-21 00:48:36 +0000
    2023-05-22 00:54:41 +0000
    2023-05-24 05:36:25 +0000
    2023-05-25 10:05:39 +0000
    2023-05-26 16:09:51 +0000
    2023-05-29 12:40:29 +0000
    2023-05-29 13:15:05 +0000
    2023-05-31 15:28:14 +0000
    2023-06-02 02:05:21 +0000
    2023-06-02 13:05:50 +0000
    2023-06-04 11:12:19 +0000
    2023-06-05 10:04:34 +0000
    2023-06-06 02:47:22 +0000
    2023-06-07 04:35:17 +0000
    2023-06-07 16:20:27 +0000
    2023-06-08 07:43:14 +0000
    2023-06-10 17:55:59 +0000
    2023-06-12 17:00:02 +0000
    2023-06-14 08:37:14 +0000
    2023-06-14 18:07:30 +0000
    2023-06-16 12:07:26 +0000
    2023-06-18 22:29:39 +0000
    2023-06-19 02:32:54 +0000
    2023-06-20 14:24:40 +0000
    2023-06-22 09:27:59 +0000
    2023-06-23 07:31:20 +0000
    2023-06-23 21:06:55 +0000
    2023-06-26 06:57:28 +0000
    2023-06-28 17:08:12 +0000
    2023-06-29 03:06:47 +0000
    2023-06-30 12:25:41 +0000
    2023-07-02 08:49:42 +0000
    2023-07-03 20:09:26 +0000
    2023-07-06 17:39:13 +0000
    2023-07-09 00:18:52 +0000
    2023-07-11 03:58:21 +0000
    2023-07-12 22:37:00 +0000
    2023-07-14 01:58:44 +0000
    2023-07-16 20:21:13 +0000
    2023-07-17 01:41:47 +0000
    2023-07-19 10:06:35 +0000
    2023-07-21 17:44:16 +0000
    2023-07-22 02:46:04 +0000
    2023-07-22 06:52:04 +0000
    2023-07-23 04:53:49 +0000
    2023-07-25 16:37:24 +0000
    2023-07-27 18:34:33 +0000
    2023-07-28 02:34:02 +0000
    2023-07-29 19:53:32 +0000
    2023-07-30 23:30:11 +0000
    2023-08-02 17:46:22 +0000
    2023-08-03 00:01:21 +0000
    2023-08-03 03:57:56 +0000
    2023-08-03 21:41:28 +0000
    2023-08-04 23:37:31 +0000
    2023-08-05 08:20:42 +0000
    2023-08-07 21:01:55 +0000
    2023-08-10 17:03:47 +0000
    2023-08-11 21:06:31 +0000
    2023-08-12 08:45:08 +0000
    2023-08-13 07:09:39 +0000
    2023-08-14 11:15:10 +0000
    2023-08-16 04:15:48 +0000
    2023-08-19 04:11:43 +0000
    2023-08-19 10:10:27 +0000
    2023-08-22 09:41:20 +0000
    2023-08-24 10:27:08 +0000
    2023-08-24 18:16:12 +0000
    2023-08-25 17:02:28 +0000
    2023-08-27 15:58:52 +0000
    2023-08-27 23:29:53 +0000
    2023-08-28 21:31:27 +0000
    2023-08-29 03:35:29 +0000
    2023-08-31 06:15:19 +0000
    2023-09-01 21:56:52 +0000
    2023-09-02 22:57:53 +0000
    2023-09-05 03:28:30 +0000
    2023-09-07 04:57:12 +0000
    2023-09-09 19:16:05 +0000
    2023-09-09 20:01:39 +0000
    2023-09-11 03:23:22 +0000
    2023-09-12 15:18:29 +0000
    2023-09-13 14:14:43 +0000
    2023-09-13 17:37:25 +0000
    2023-09-14 18:17:49 +0000
    2023-09-16 19:56:55 +0000
    2023-09-18 14:21:02 +0000
    2023-09-21 00:34:13 +0000
    2023-09-23 07:14:06 +0000
    2023-09-24 17:22:22 +0000
    2023-09-27 12:42:54 +0000
    2023-09-28 14:48:45 +0000
    2023-10-01 11:54:24 +0000
    2023-10-03 07:36:32 +0000
    2023-10-05 05:13:57 +0000
    2023-10-06 16:07:06 +0000
    2023-10-09 00:03:52 +0000
    2023-10-09 02:32:01 +0000
    2023-10-10 16:39:07 +0000
    2023-10-12 13:28:16 +0000
    2023-10-14 04:29:14 +0000
    2023-10-17 03:30:24 +0000
    2023-10-20 03:13:15 +0000
    2023-10-20 20:47:06 +0000
    2023-10-21 13:59:34 +0000
    2023-10-23 21:38:48 +0000
    2023-10-24 06:07:13 +0000
    2023-10-25 22:51:17 +0000
    2023-10-26 21:12:50 +0000
    2023-10-28 05:52:20 +0000
    2023-10-29 22:11:01 +0000
    2023-10-30 12:29:25 +0000
    2023-11-02 02:52:55 +0000
    2023-11-02 06:00:32 +0000
    2023-11-03 08:39:06 +0000
    2023-11-04 23:51:22 +0000
    2023-11-07 16:11:33 +0000
    2023-11-10 10:55:29 +0000
    2023-11-12 01:20:18 +0000
    2023-11-12 04:22:50 +0000
    2023-11-12 08:38:58 +0000
    2023-11-13 15:43:40 +0000
  TIMES

  # DB seed
  events   = []
  event40s = []
  TIMES.each_line(chomp: true).with_index do |time, i|
    count = i + 1
    events   << { title: "Event ##{count}", time:}
    event40s << { title: "Event ##{count}", time:} if count <= 40
  end
  Event.insert_all(events)
  Event40.insert_all(event40s)

  PETS = <<~PETS
    Luna  | dog    | 2018-03-10
    Coco  | cat    | 2019-05-15
    Dodo  | dog    | 2020-06-25
    Wiki  | bird   | 2018-03-12
    Baby  | rabbit | 2020-01-13
    Neki  | horse  | 2021-07-20
    Tino  | donkey | 2019-06-18
    Plot  | cat    | 2022-09-21
    Riki  | cat    | 2018-09-14
    Susi  | horse  | 2018-10-26
    Coco  | pig    | 2020-08-29
    Momo  | bird   | 2023-08-25
    Lili  | cat    | 2021-07-22
    Beli  | pig    | 2020-07-26
    Rocky | bird   | 2022-08-19
    Vyvy  | dog    | 2018-05-16
    Susi  | horse  | 2024-01-25
    Ella  | cat    | 2020-02-20
    Rocky | dog    | 2019-09-19
    Juni  | rabbit | 2020-08-24
    Coco  | bird   | 2021-03-17
    Susi  | dog    | 2021-07-28
    Luna  | horse  | 2023-05-14
    Gigi  | pig    | 2022-05-19
    Coco  | cat    | 2020-02-20
    Nino  | donkey | 2019-06-17
    Luna  | cat    | 2022-02-09
    Popi  | dog    | 2020-09-26
    Lili  | pig    | 2022-06-18
    Mina  | horse  | 2021-04-21
    Susi  | rabbit | 2023-05-18
    Toni  | donkey | 2018-06-22
    Rocky | horse  | 2019-09-28
    Lili  | cat    | 2019-03-18
    Roby  | cat    | 2022-06-19
    Anto  | horse  | 2022-08-18
    Susi  | pig    | 2021-04-21
    Boly  | bird   | 2020-03-29
    Sky   | cat    | 2023-07-19
    Lili  | dog    | 2020-01-28
    Fami  | snake  | 2023-04-27
    Lopi  | pig    | 2019-06-19
    Rocky | snake  | 2022-03-13
    Denis | dog    | 2022-06-19
    Maca  | cat    | 2022-06-19
    Luna  | dog    | 2022-08-15
    Jeme  | horse  | 2019-08-08
    Sary  | bird   | 2023-04-29
    Rocky | bird   | 2023-05-14
    Coco  | dog    | 2023-05-27
  PETS

  # DB seed
  pets = []
  PETS.each_line(chomp: true) do |pet|
    name, animal, birthdate = pet.split('|').map(&:strip)
    pets << { name:, animal:, birthdate: }
  end
  Pet.insert_all(pets)

  # sequel
  DB.create_table! :pets_sequel do
    primary_key :id
    String :animal,    unique: false, null: false
    String :name,      unique: false, null: false
    Date   :birthdate, unique: false, null: false
  end

  dataset = DB[:pets_sequel]

  PETS.each_line(chomp: true) do |pet|
    name, animal, birthdate = pet.split('|').map(&:strip)
    dataset.insert(name:, animal:, birthdate:)
  end
end

class PetSequel < Sequel::Model(:pets_sequel)
end
