Last active
July 10, 2021 04:02
-
-
Save mattlord/044596001676e4ca3e51bf791e47bd53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Signed into https://app.planetscale.com using GitHub | |
## | |
# Install CLI | |
$ brew tap planetscale/tap | |
$ brew install pscale | |
$ pscale login | |
Confirmation Code: ******** | |
If something goes wrong, copy and paste this URL into your browser: https://auth.planetscale.com/oauth/device?user_code=******** | |
Successfully logged in. | |
$ pscale db create mlordtest | |
Database mlordtest was successfully created. | |
$ pscale db ls | |
NAME CREATED AT UPDATED AT NOTES | |
----------- --------------- --------------- ------- | |
mlordtest 4 seconds ago 4 seconds ago | |
$ pscale connect mlordtest & | |
Secure connection to database mlordtest and branch main is established!. | |
Local address to connect your application: 127.0.0.1:3306 (press ctrl-c to quit) | |
$ mysql --protocol=tcp | |
Welcome to the MySQL monitor. Commands end with ; or \g. | |
Your MySQL connection id is 498 | |
Server version: 8.0.23-vitess Version: 11.0.0-SNAPSHOT (Git revision 13dadf3 branch 'main') built on Tue Jun 8 05:25:32 UTC 2021 by vitess@buildkitsandbox using go1.15.6 linux/amd64 | |
Copyright (c) 2000, 2021, 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 | | |
+--------------------+ | |
| mlordtest | | |
| information_schema | | |
| mysql | | |
| sys | | |
| performance_schema | | |
+--------------------+ | |
5 rows in set (0.03 sec) | |
mysql> show keyspaces; | |
+-----------+ | |
| Database | | |
+-----------+ | |
| mlordtest | | |
+-----------+ | |
1 row in set (0.03 sec) | |
mysql> show vitess_shards; | |
+-------------+ | |
| Shards | | |
+-------------+ | |
| mlordtest/- | | |
+-------------+ | |
1 row in set (0.04 sec) | |
mysql> show vitess_tablets; | |
+----------------+-----------+-------+------------+---------+---------------------------+----------------+----------------------+ | |
| Cell | Keyspace | Shard | TabletType | State | Alias | Hostname | MasterTermStartTime | | |
+----------------+-----------+-------+------------+---------+---------------------------+----------------+----------------------+ | |
| aws_useast1a_3 | mlordtest | - | REPLICA | SERVING | aws_useast1a_3-3100530406 | **.***.***.*** | | | |
| aws_useast1b_3 | mlordtest | - | MASTER | SERVING | aws_useast1b_3-1844576766 | **.***.***.*** | 2021-07-09T23:33:43Z | | |
| aws_useast1c_3 | mlordtest | - | REPLICA | SERVING | aws_useast1c_3-0582399292 | **.***.***.*** | | | |
+----------------+-----------+-------+------------+---------+---------------------------+----------------+----------------------+ | |
3 rows in set (0.03 sec) | |
mysql> select current_user(); | |
+------------------+ | |
| current_user() | | |
+------------------+ | |
| vt_app@localhost | | |
+------------------+ | |
1 row in set (0.02 sec) | |
mysql> select user,host from mysql.user; | |
+------------------+-----------+ | |
| user | host | | |
+------------------+-----------+ | |
| orc_client_user | % | | |
| vt_repl | % | | |
| mysql.infoschema | localhost | | |
| mysql.session | localhost | | |
| mysql.sys | localhost | | |
| root | localhost | | |
| vt_allprivs | localhost | | |
| vt_app | localhost | | |
| vt_appdebug | localhost | | |
| vt_dba | localhost | | |
| vt_filtered | localhost | | |
| vt_monitoring | localhost | | |
+------------------+-----------+ | |
12 rows in set (0.03 sec) | |
mysql> use mlordtest; | |
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> create table t1 (id serial, name varchar(100)); | |
ERROR 1105 (HY000): direct DDL is disabled | |
$ pscale branch create mlordtest t1 | |
Branch t1 was successfully created. | |
$ pscale branch ls mlordtest | |
NAME STATUS PARENT BRANCH CREATED AT UPDATED AT | |
------ -------- --------------- ---------------- ---------------- | |
main n/a 24 minutes ago 23 minutes ago | |
t1 main 17 seconds ago 5 seconds ago | |
$ pscale shell mlordtest t1 | |
mlordtest/t1> create table t1 (id serial, name varchar(100)); | |
$ pscale deploy-request create mlordtest t1 | |
Deploy request #1 successfully created. | |
$ pscale dr ls mlordtest | |
ID NUMBER BRANCH INTO BRANCH APPROVED STATE DEPLOY STATE DEPLOYABLE QUEUED AT STARTED AT FINISHED AT CREATED AT UPDATED AT CLOSED AT | |
-------------- -------- -------- ------------- ---------- ------- -------------- ------------ ---------------- ---------------- ------------- ------------ ------------ ----------- | |
b6volth1gsez 1 t1 main No open ready Yes 50 seconds ago 50 seconds ago | |
$ pscale dr diff mlordtest 1 | |
-- t1 -- | |
+CREATE TABLE `t1` ( | |
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT, | |
+ `name` varchar(100) DEFAULT NULL, | |
+ UNIQUE KEY `id` (`id`) | |
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |
$ pscale dr review mlordtest 1 --approve | |
Deploy request mlordtest/1 is approved. | |
$ pscale dr ls mlordtest | |
ID NUMBER BRANCH INTO BRANCH APPROVED STATE DEPLOY STATE DEPLOYABLE QUEUED AT STARTED AT FINISHED AT CREATED AT UPDATED AT CLOSED AT | |
-------------- -------- -------- ------------- ---------- ------- -------------- ------------ --------------- --------------- ------------- ------------ ------------ ----------- | |
b6volth1gsez 1 t1 main Yes open ready Yes 3 minutes ago 3 minutes ago | |
$ pscale dr deploy mlordtest 1 | |
Successfully deployed b6volth1gsez from t1 to main. | |
$ pscale dr ls mlordtest | |
ID NUMBER BRANCH INTO BRANCH APPROVED STATE DEPLOY STATE DEPLOYABLE QUEUED AT STARTED AT FINISHED AT CREATED AT UPDATED AT CLOSED AT | |
-------------- -------- -------- ------------- ---------- -------- -------------- ------------ ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- | |
b6volth1gsez 1 t1 main Yes closed complete Yes 26 seconds ago 26 seconds ago 17 seconds ago 48 seconds ago 16 seconds ago 16 seconds ago | |
$ mysql --protocol=tcp | |
Welcome to the MySQL monitor. Commands end with ; or \g. | |
Your MySQL connection id is 483 | |
Server version: 8.0.23-vitess Version: 11.0.0-SNAPSHOT (Git revision 13dadf3 branch 'main') built on Tue Jun 8 05:25:32 UTC 2021 by vitess@buildkitsandbox using go1.15.6 linux/amd64 | |
... | |
mysql> show create table t1\G | |
*************************** 1. row *************************** | |
Table: t1 | |
Create Table: CREATE TABLE `t1` ( | |
`id` bigint unsigned NOT NULL AUTO_INCREMENT, | |
`name` varchar(100) DEFAULT NULL, | |
UNIQUE KEY `id` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci | |
1 row in set (0.03 sec) | |
mysql> insert into t1 (name) values ("lord"); | |
Query OK, 1 row affected (0.03 sec) | |
mysql> insert into t1 (name) values ("lord2"); | |
Query OK, 1 row affected (0.04 sec) | |
mysql> select * from t1; | |
+----+-------+ | |
| id | name | | |
+----+-------+ | |
| 1 | lord | | |
| 2 | lord2 | | |
+----+-------+ | |
2 rows in set (0.03 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment