We have 2 RDS databases on aws, qa and production. What I'm trying to do is copy all the records from our production db to qa. I created a new instance of production from a snapshot and pointed the connection string in my app from the qa instance to the new production instance. However the new production instance does not have the migrations needed by the app to run as we have not deployed those changes to yet.
So basically I have migrations in the qa db I'm looking to copy into the new instance of production so I can test the latest changes with current records.
Is there a way to add the migrations from the qa db into prod snapshot or is there a way to copy records from prod into qa which already has those migrations?
What I tried:
small code change to see if redeploy would run migrations
added empty migration and redeployed
-- the prod db sees the new migration but none of the other ones
A Snapshot of an Amazon RDS database contains all data that was in the source database at the time the snapshot was made.
The Snapshot can be used to create a new Amazon RDS database, which will contain all the data from the Snapshot.
It is not possible to modify a Snapshot after it has been created.
As for "a way to copy records from prod into qa", this is not a native capability of Amazon RDS. You would need to use an SQL client to copy data between databases.
Related
I've develop a web platform that uses a PostgresSQL database along with Hasura to make GraphQL interface. This platform was deployed on a Google Cloud enviroment: the database is running in a Google Cloud SQL instance, the Hasura and a simple node.js servers are running on Cloud Run instances.
Anyway, since the database should keep growing, I need a secure and reliable way to keep track of changes done in development env to futher deploy it to production database.
The buck of the edits to the database schema are done using the Hasura Console and by now I just need a solution to track changes in data schema made in development enviroment to deploy only the needed changes to production
Reading about migrations I've found out Flyway as a solution to keep of these changes. However, there still some concerns about the implementation of Flyway in the project. But a couple of question arrise:
Is it possible to use the PostgresSQL (pgAdmin) backup generated files as migrations?
How could I make a migration from a development to the production database? Just by adding the remote url from Google Cloud SQL the do the migration?
There's no much need to keep track of changes of the data in production.
Is there a better option to control changes between development and production databases?
If a make frequent schema backup (using pgAdmin Backup tool) and run restore on the production database, it would do what I want?
Is it possible to use the PostgresSQL (pgAdmin) backup generated files as migrations?
I think you are going the wrong way. Flyway is about the migration scripts you execute to propogate DB version. The backup file contains the whole database. If you want to replace the whole database with the new version of it you may simply drop the old one and create the new one, but you will loose data that way. You can of course use flyway to restore the backup for you, but that way you'll get only the version table. If you'll update over several versions, then multiple restores will be performed that is not needed.
How could I make a migration from a development to the production database? Just by adding the remote url from Google Cloud SQL the do the migration?
I tried google'ing (entered "Google Cloud SQL flyway") and the first result pointed me to Umberto D'Ovido post Setup Flyway with Google Cloud SQL I'm sure with a little effor you'll find the instructions.
I would like to know how to update an existing database from another database in mongodb ... but previously a little of context.
I've created an app with strapi and mongodb ( more precisely with mongo atlas) and I'm using 2 environments, development and production(with a development and production database). At the beginning, i've created the development database and i copied/cloned this database to another database with this command (previously I created the db file with mongodump)
mongorestore --uri="mongodb+srv://<username>:<password>#<cluster-url>" --archive="app-development.db" --nsFrom='app-development.*' --nsTo='app-production.*
After creating this database i carried on with my develop into the development database, and now i would like to import the development database into the production database...but i got the error continuing through error: E11000 duplicate key error collection
So I don't know how can i re-import the databases, and also i would like to know if this way is a good practice or i should do it in a different way
I want to migrate a production SQL Server database which is more than 400gb in size to a new environment at a different hosting provider.
How can I do that without a lot of downtime?
Some options.
Create a full backup on system A, copy the backup to system B and restore it there.
Detach the database on system A, copy all db-files (mdf,ldf, ndf) to system B and attach them there
Import and export data wizard
Remember to also re-create jobs, dts-packages etc where relevant
You can use mirroring...
Install new sql server instance and create mirror db on this new server from prod db 2. Wait until db's are synchronized and turn off the old server 3. Now remove mirror from new server and recover the mirrored db.
Moving SQL Server database from old production server to new server
Or go thorough the below blog which states 8 step to migrate safely without downtime
8 Steps to Safely Migrate a Database Without Downtime
I have a SQL Server CE database on my 'live' host that I deployed a few weeks ago. It has a migration history of two old migrations. Then I have my dev database, that has gone through umpteen migrations, and several delete and recreate moments.
Now I would like to use EF migrations to build a migration that will update the production db to match my code-first model on dev. I thought that if I cleared the prod migration history, and ran Add-Migration, EF would compare database and model, and generate a migration class to bring the db up to date with the model.
What really happens is that the migration that gets generated tries to create the whole dd, well, all tables, FKs, and Indexes. How do I get a proper update only, using EF migrations?
If you still have the deployed migration on your Dev box, you can create a script that will bring the deployed version up to date:
Update-Database -Script -SourceMigration: VersionDeployed -TargetMigration: CurrentMigration
You could also try bringing the PROD database down with the migration history (don't clear it). EF should compare the model in the last migration to the current model based on code.
http://cpratt.co/migrating-production-database-with-entity-framework-code-first/#at_pco=smlwn-1.0&at_si=54ad5c7b61c48943&at_ab=per-12&at_pos=0&at_tot=1
When I register my SQL Server 2012 database as a data-Tier application, then turn around and delete the database, the record created in the 'sdb.dbo.sysdac_instances_internal' table is still there.
What's worse if I restore the database with an older backup, it keeps the version number of the deleted database. My deploys are failing because the database 'drifted'. I have version-dependent logic in my pre/post deploy scripts where I expect a version to correspond to a specific schema version.
Is there a way to wipe out the sysdac_instances_internal record on database drops but restore it during database restore? I know I can register/unregister as a data-tier app, but I can't reconcile that way. The schema and version seems out of sync/disconnected here.