Database design based on MySQL using Erwin

Source: Internet
Author: User
Tags datetime odbc mysql mysql database mysql odbc driver

Erwin is commonly used for database design tools, support a large number of databases, but not support MySQL, probably because few companies use MySQL bar, but MySQL is actually very good.

In order to be able to use Erwin to perform physical design based on MySQL database, the following methodological steps can be used:

(assuming you already have a well-designed logical MODEL)

1. Install MySQL ODBC DRIVER, you can go to mysql.com, there are links can download.

2. Create a user DSN in the ODBC management program that connects to your MySQL database.

3. Build a physical model based on ODBC 2.0 from the established logical model.

4. This step is focused on:

Because ODBC-generated database scripts are not fully compatible with MySQL's SQL syntax, you need to do some other work. For example, sometimes you need to use the datetime type, but you can only generate the date type, we can do it with SQL script, there are two kinds of scripts supported by Erwin: Model-level, Table-level. The former is for the whole physical MODEL, and the latter can be used for one or more table. According to the order of operation, there are two kinds:

Pre script, Post script. I know the meaning by looking at the name. If we want to set the type of "create_on" in the table to datetime, we can generate a table-level SCRIPT:

ALTER TABLE%tablename MODIFY create_on Datetime%tablename is a Erwin-brought macro, as well as many other macros, for which you can see Help.

You can also define different script depending on your needs (for example, you need to set a field of auto_increment).

5. Select Pre Script,post Script in forward engineer, then generate it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.