create ER diagram with MySQL Workbench

create ER diagram without using actual db table linking.

Edit -> preference

Modeling -> Appearance

Change font to Japanease

How to start the mode to write ER diagram

[Add Diagram]
Create a new diagram with the ER diagram mode.

あーこれこれ^^ いいねーテンション上がってきました。

What is workbench

1. MySQL Workbench
MySQL Workbench is a free tool which realizes databases design, development and management distributed with MySQL Server on the official MySQL site. It corresponds to visual operation(GUI) instead of command line, it is recommended for those who are not good at command operation.

2. Functions of MySQL Workbench
In terms of database design, it is possible to create new ER diagrams, and it is also possible to generate ER diagrams in reverse from existing databases.

In terms of database development, it supports not only query creation and execution of SQL but also visual display that can perform optimization with intuitive operation. In addition to the color highlight display and automatic completion function, the SQL editor also supports SQL execution history display, SQL statement reuse, and object browser, making it a very excellent development tool as a SQL editor.

Download MySQL Workbench 8.0.15

Regular Expression for Space Character Check

/[^\s ]/

Blank letters(\s) and double-byte spaces ( ) other than(^) are included.

– \s is a blank character abbreviation, including single-byte spaces, tabs, and new-line characters.
– The space after \s is full-width space
– Double-byte spaces are treated the same as Kanji, so the are not included in \s.
– Brackets([]) mean one character in parentheses. If there is no [], it will search for chunks of “\s”. If you use ^ outside of [], it means a different meaning.

$value = "富士山 が良く見える";

if (preg_match('/[^\s ]+$/u', $value)){
	echo "スペースが含まれています";
} else {
	echo "スペースが含まれていません";
}

What? Something is not working well.

禁則文字とは?

A character that comes inappropriate or difficult to read when it comes to the beginning of a line or at the end of a line. Representative examples include punctuation marks and parentheses. There are two kinds of prohibited character and the end-of-line prohibition character. The former refers to characters that you are having trouble coming up at the beginning of the line, and the latter refers to characters that you do not have trouble coming to the end of the line.

The following escape sequences are available.

\n 改行
\r キャリッジリターン
\t タブ
\\ \文字
\$ $文字
\( 左括弧
\) 右括弧
\[ 左括弧
\/ 右括弧
\' シングルクオテーション
\" ダブルクオテーション
\nnn 8進数表記
\xnn 16進数表記

Half-size check with regular expression

Half-size check with regular expression
Represent other than half-width characters in [^…] part.

$value = "こんにちは";

echo preg_match('/^[^ -~。-°\x00-\x1f\t]+$/u', $value);

[vagrant@localhost tests]$ ls
index.php
[vagrant@localhost tests]$ php -S 192.168.35.10:8000
PHP 7.1.21 Development Server started at Fri Feb 8 20:56:23 2019
Listening on http://192.168.35.10:8000
Document root is /home/vagrant/local/app/tests
Press Ctrl-C to quit.
[Fri Feb 8 20:56:31 2019] PHP Warning: preg_match(): Compilation failed: range out of order in character class at offset 11 in /home/vagrant/local/app/tests/index.php on line 5

なに? 修正します。

$value = "123";

if (preg_match('/^[^ -~。-゚\x00-\x1f\t]+$/u', $value)){
	echo "yes";
} else {
	echo "半角です";
}

/u
→ UTF-8 character code

OK

MWB file, WorkBench

What is the .mwb file, which is found at entity-relation.
It seems that there are many cases to make using SQL development tool / ER diagram tool such as “MySQL Workbench” or “A5ER” when using database ER diagram.

Roll back git remote repository

Those that pushed to the remote repository can not be rewound to the past state, or other members may start working. (It is possible to use supplementary git reset)
Roll back by executing the following command and pushing the processing opposite to the pushed contents.

git revert <commit id>
git revert bd912e1

When if it is merged, execute the command.

git revert-m 1 <commit_ID>
git revert-m 1 bd912e1

Linux “sed” command

Replace the character string / output the replaced line

[vagrant@localhost tests]$ ls
baio.txt

baio.txt

2019 年 MM 月 DD 日に発表いたしました、再生細胞薬「SBXXX」の慢性期脳梗塞を対象にした
米国でのフェーズ N 臨床試験の解析結果について、患者さんからの声をたくさんお寄せ
いただいております。改めて私より、今後についてお伝えさせていただきたいと思います。

To replace the character string, use “s” command and specify “s/beforeReplacment/afterReplacement”

[vagrant@localhost tests]$ cat baio.txt
2019 年 MM 月 DD 日に発表いたしました、再生細胞薬「SBXXX」の慢性期脳梗塞を対象にした
米国でのフェーズ N 臨床試験の解析結果について、患者さんからの声をたくさんお寄せ
いただいております。改めて私より、今後についてお伝えさせていただきたいと思います。

[vagrant@localhost tests]$ cat baio.txt | sed s/患者/株主/
2019 年 MM 月 DD 日に発表いたしました、再生細胞薬「SBXXX」の慢性期脳梗塞を対象にした
米国でのフェーズ N 臨床試験の解析結果について、株主さんからの声をたくさんお寄せ
いただいております。改めて私より、今後についてお伝えさせていただきたいと思います。