higher68 / upsd-c-test

0 stars 0 forks source link

DB周り整備 #3

Closed higher68 closed 1 year ago

higher68 commented 1 year ago

やる

仕様

確認

# db setup
❯ docker-compose up -d db
[+] Building 0.0s (0/0)                                                                                                                                    docker:desktop-linux
[+] Running 1/1
 ✔ Container test-db  Started                                                                                                                                              0.2s 
❯ npx dotenv -e .env.local -- npx prisma migrate dev --name test
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "test" at "localhost:13306"

Applying migration `20231101120815_test`

The following migration(s) have been created and applied from new schema changes:

migrations/
  └─ 20231101120815_test/
    └─ migration.sql

❯ docker run -it --network container:test-db --rm mysql mysql -h127.0.0.1 -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.2.0 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.03 sec)

mysql> use test
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
mysql> show tables;
+--------------------+
| Tables_in_test     |
+--------------------+
| Client             |
| ClientBankAccount  |
| Company            |
| InvoiceData        |
| User               |
| _prisma_migrations |
+--------------------+
6 rows in set (0.01 sec)
higher68 commented 1 year ago

/close