MySQL Database Deployment Strategy In Production
I am looking for ideas for a MySQL database deployment strategy in production.
My scenario is as below:
- I have a job which creates a SQL dump of bunch of static tables
- I have an existing schema in production which contains the above set of static tables along with other tables.
- I want to apply the dump created in step 1 on the production database schema
One idea would be to create the table in the dump with some postfix say _new and then swap the tables using mysql RENAME command. But I'm not sure about the issues associated with this approach mysql manual says RENAME works only if there are no transactional locks taken and also using RENAME command results in dropping of all the constraints on the new swapped table the command would look like below.
rename table foo to foo_old, foo_new to foo;
Other idea I am thinking of is if there is some feature to create schema aliases and during deployment I can create a totally new schema from the original and then point the alias to the new schema which seems less risky but not sure MySQL supports this.
Any ideas and references on this would be really helpful, thank you!
mysql sql database mysql-5.7 database-deployment
add a comment |
I am looking for ideas for a MySQL database deployment strategy in production.
My scenario is as below:
- I have a job which creates a SQL dump of bunch of static tables
- I have an existing schema in production which contains the above set of static tables along with other tables.
- I want to apply the dump created in step 1 on the production database schema
One idea would be to create the table in the dump with some postfix say _new and then swap the tables using mysql RENAME command. But I'm not sure about the issues associated with this approach mysql manual says RENAME works only if there are no transactional locks taken and also using RENAME command results in dropping of all the constraints on the new swapped table the command would look like below.
rename table foo to foo_old, foo_new to foo;
Other idea I am thinking of is if there is some feature to create schema aliases and during deployment I can create a totally new schema from the original and then point the alias to the new schema which seems less risky but not sure MySQL supports this.
Any ideas and references on this would be really helpful, thank you!
mysql sql database mysql-5.7 database-deployment
add a comment |
I am looking for ideas for a MySQL database deployment strategy in production.
My scenario is as below:
- I have a job which creates a SQL dump of bunch of static tables
- I have an existing schema in production which contains the above set of static tables along with other tables.
- I want to apply the dump created in step 1 on the production database schema
One idea would be to create the table in the dump with some postfix say _new and then swap the tables using mysql RENAME command. But I'm not sure about the issues associated with this approach mysql manual says RENAME works only if there are no transactional locks taken and also using RENAME command results in dropping of all the constraints on the new swapped table the command would look like below.
rename table foo to foo_old, foo_new to foo;
Other idea I am thinking of is if there is some feature to create schema aliases and during deployment I can create a totally new schema from the original and then point the alias to the new schema which seems less risky but not sure MySQL supports this.
Any ideas and references on this would be really helpful, thank you!
mysql sql database mysql-5.7 database-deployment
I am looking for ideas for a MySQL database deployment strategy in production.
My scenario is as below:
- I have a job which creates a SQL dump of bunch of static tables
- I have an existing schema in production which contains the above set of static tables along with other tables.
- I want to apply the dump created in step 1 on the production database schema
One idea would be to create the table in the dump with some postfix say _new and then swap the tables using mysql RENAME command. But I'm not sure about the issues associated with this approach mysql manual says RENAME works only if there are no transactional locks taken and also using RENAME command results in dropping of all the constraints on the new swapped table the command would look like below.
rename table foo to foo_old, foo_new to foo;
Other idea I am thinking of is if there is some feature to create schema aliases and during deployment I can create a totally new schema from the original and then point the alias to the new schema which seems less risky but not sure MySQL supports this.
Any ideas and references on this would be really helpful, thank you!
mysql sql database mysql-5.7 database-deployment
mysql sql database mysql-5.7 database-deployment
edited Nov 12 '18 at 22:20
willsteel
asked Nov 12 '18 at 22:18
willsteelwillsteel
3761616
3761616
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270902%2fmysql-database-deployment-strategy-in-production%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270902%2fmysql-database-deployment-strategy-in-production%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown