MariaDB のデータ読み書きは mysql Command-line Client - MariaDB Knowledge Base を使用します。
Docker Desktop の Dashboard から MariaDB が動作しているコンテナの CLI を開きます。
CLI の開き方は Docker Dashboard | Docker Documentation から確認できます。
CLI 内で mysql -u mysql -pmysql
と入力します。
データベース一覧を表示するには、次のコマンドを入力します。
サンプルアプリでは、データベース concert
を使用しています。
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| concert |
| information_schema |
+--------------------+
2 rows in set (0.000 sec)
データベース concert
のテーブル一覧を表示するには、次のコマンドを入力します。
サンプルアプリでは、2つのテーブル( CONCERTS
, akka_projection_offset_store
) を使用しています。
MariaDB [(none)]> use concert;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [concert]> show tables;
+------------------------------+
| Tables_in_concert |
+------------------------------+
| CONCERTS |
| akka_projection_offset_store |
+------------------------------+
2 rows in set (0.000 sec)
テーブル CONCERTS
のレコード一覧を表示するには、次のコマンドを入力します。
テーブル CONCERTS
には、サンプルアプリのリードモデルで使用する情報が保存されています。
MariaDB [concert]> select * from CONCERTS;
+---------+-------------------+-----------+---------------------+---------------------+
| ID | NUMBER_OF_TICKETS | CANCELLED | CREATED_AT | UPDATED_AT |
+---------+-------------------+-----------+---------------------+---------------------+
| example | 0 | 0 | 2021-05-17 09:21:55 | 2021-05-17 09:22:25 |
| RHCP | 1 | 1 | 2021-05-17 09:21:47 | 2021-05-17 09:22:14 |
+---------+-------------------+-----------+---------------------+---------------------+
2 rows in set (0.000 sec)
akka_projection_offset_store
は、
サンプルアプリで使用している Akka Projection
のオフセット情報を保存するために使用されています。
オフセットテーブルのスキーマは、Schema | Offset in a relational DB with Slick • Akka Projection から確認できます。
オフセット一覧を表示するには、次のコマンドを入力します。
MariaDB [concert]> select * from akka_projection_offset_store;
+-----------------+----------------+--------------------------------------+----------+-----------+---------------+
| projection_name | projection_key | current_offset | manifest | mergeable | last_updated |
+-----------------+----------------+--------------------------------------+----------+-----------+---------------+
| concerts | ConcertEvent | f46b3da0-b6a5-11eb-96e4-b3d549524c67 | TBU | 0 | 1621210950876 |
+-----------------+----------------+--------------------------------------+----------+-----------+---------------+
1 row in set (0.000 sec)