We have a MySQL Workbench project with two tabs (two schemas/two databases).
magikweb_dev_igcweb
.magikweb_dev_igcweb_archive
.If we copy-paste/duplicate a table from the first tab to the second tab, the resulting table remains in the first schema. How can you change a table's schema?
Each schema is linked with a specific database, so when we use the "Synchronize Model..." feature, it links all the tables properly.
A schema change is an alteration made to a collection of logical structures (or schema objects) in a database. Schema changes are generally made using structured query language (SQL) and are typically implemented during maintenance windows.
ALTER SCHEMA changes the definition of a schema. You must own the schema to use ALTER SCHEMA . To rename a schema you must also have the CREATE privilege for the database. To alter the owner, you must also be a direct or indirect member of the new owning role, and you must have the CREATE privilege for the database.
You can use DDL to add, modify, or remove schema objects as the database is running. For a list of all valid DDL you can use, see Appendix A, Supported SQL DDL Statements. You can do the following types of schema changes: Modifying Tables — You can add, modify (alter), and remove (drop) table columns.
To rename a schema, the role used to perform the operation must have the CREATE SCHEMA privilege on the database for the schema and OWNERSHIP privileges on the schema. To swap two schemas, the role used to perform the operation must have OWNERSHIP privileges on both schemas.
Follow this simple steps (never miss step 4 and 5) :
Open Model Tab
Choose source schema. In my case, I want to copy table users
from schema abc_develop_v1
to schema abc_develop_v2
then paste to diagram . So I choose schema abc_develop_v1
, right-click table users
then Copy 'users'
Go to the targeted schema. In my case is schema abc_develop_v2
, right-click then Paste 'users'
Next, copy table users
from schema abc_develop_v2
. Right-click table users
then Copy 'users'
Go to your diagram and Paste 'users'.
That's all. Your table is ready in your diagram with the right schema
:-)
Notes: You can double check by double-click on the table in your diagram, and look at the right corner. It will show the
Schema
name.
Use the model tab. You can cut out a table from one schema tab and insert it into another.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With