data-migration

How can I transfer data between 2 MySQL databases?

早过忘川 提交于 2019-11-28 21:16:42
I want to do that using a code and not using a tool like "MySQL Migration Toolkit". The easiest way I know is to open a connection (using MySQL connectors) to DB1 and read its data. Open connection to DB2 and write the data to it. Is there a better/easiest way ? First I'm going to assume you aren't in a position to just copy the data/ directory, because if you are then using your existing snapshot/backup/restore will probably suffice (and test your backup/restore procedures into the bargain). In which case, if the two tables have the same structure generally the quickest, and ironically the

How do I move a column (with contents) to another table in a Rails migration?

北城以北 提交于 2019-11-28 16:43:05
I need to move some columns from one existing table to another. How do I do it using a rails migration? class AddPropertyToUser < ActiveRecord::Migration def self.up add_column :users, :someprop, :string remove_column :profiles, :someprop end def self.down add_column :profiles, :someprop, :string remove_column :users, :someprop end end The above just creates the new columns, but values are left empty... I want to avoid logging in to the database to manually update the tables. If there is a way to move column values programmatically, what are the performance characteristics? Would it do row-by

How do I move a redis database from one server to another?

◇◆丶佛笑我妖孽 提交于 2019-11-28 15:01:38
I currently have a live redis server running on a cloud instance and I want to migrate this redis server to a new cloud instance and use that instance as my new redis server. If it were MySQL, I would export the DB from the old server and import it into the new server. How should I do this with redis? P.S.: I'm not looking to set-up replication. I want to completely migrate the redis server to a new instance. Anurag Save a snapshot of the database into a dump.rdb by either running BGSAVE or SAVE from the command line. This will create a file named dump.rdb in the same folder as your redis

How to efficiently manage frequent schema changes using sqlalchemy?

拟墨画扇 提交于 2019-11-28 14:25:23
问题 I'm programming a web application using sqlalchemy. Everything was smooth during the first phase of development when the site was not in production. I could easily change the database schema by simply deleting the old sqlite database and creating a new one from scratch. Now the site is in production and I need to preserve the data, but I still want to keep my original development speed by easily converting the database to the new schema. So let's say that I have model.py at revision 50 and

SQL Server Copying tables from one database to another

余生颓废 提交于 2019-11-28 07:29:07
问题 I have two databases, one is called Natalie_playground and one is called LiveDB . Since I want to practice insert, update things, I want to copy some of the tables from the LiveDB to Natalie_playground . The tables I want to copy are called: Customers, Computers, Cellphones, Prices What I tried to do is that (using SSMS) right click on a table but there is no Copy in there! 回答1: Assuming that you have two databases, for example A and B: If target table not exists, the following script will

Exporting from SQLite to SQL Server

ぐ巨炮叔叔 提交于 2019-11-28 05:21:55
Is there a tool to migrate an SQLite database to SQL Server (both the structure and data)? swilliams SQLite does have a .dump option to run at the command line. Though I prefer to use the SQLite Database Browser application for managing SQLite databases. You can export the structure and contents to a .sql file that can be read by just about anything. File > Export > Database to SQL file. Krivers I know that this is old thread, but I think that this solution should be also here. Install ODBC driver for SQLite Run odbcad32 for x64 or C:\Windows\SysWOW64\odbcad32.exe for x86 Create SYSTEM DSN,

Steps to migrate Core Data databases for shipped iPhone apps

烈酒焚心 提交于 2019-11-27 23:08:37
What are the recommended steps to be done for migrating Core Data DB changes for updated iPhone apps already shipped? Is there any prior step one need (should) have done before shipping a Core Data app? Boon Apple has published a guide with regards to this topic: Introduction to Core Data Model Versioning and Data Migration Programming Guide If you find the guide hard to follow (and it can be), this SO post may come in handy too: What do I have to do to get Core Data to automatically migrate models? 来源: https://stackoverflow.com/questions/1262352/steps-to-migrate-core-data-databases-for

mysqldump equivalent for SQL Server

霸气de小男生 提交于 2019-11-27 19:28:35
Is there an equivalent schema & data export/dumping tool for SQL Server as there is for MySQL with mysqldump. Trying to relocate a legacy ASP site and I am way out of happy place with working on a windows server. Note: The DTS export utility own seems to export data, without table defs. Using the Enterprise Manager and exporting the db gets closer with exporting the schema & data... but still misses stored procedures. Basically looking for a one does it all solution that grabs everything I need at once. Erick The easiest way is the sql server database publishing wizard. Open source Free Does

How to implement IDbContextFactory for use with Entity Framework data migrations

流过昼夜 提交于 2019-11-27 19:15:50
I am trying to use Entity Framework data migrations, as described in this post . However, when I try to execute the Enable-Migrations step, I receive the following error in Package Manager Console: The target context 'MyDataContext' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory So, I created a factory class that implements IDbContextFactory in the project that contains my DbContext class, but data migrations doesn't appear to recognize it. Is there something that I should explicitly do to instruct data migrations to use this factory class? I

Django: What are the best practices to migrate a project from sqlite to PostgreSQL

牧云@^-^@ 提交于 2019-11-27 17:27:52
I need to migrate a complex project from sqlite to PostgreSQL. A lot of people seems to have problem with foreign keys, data truncature and so on... Is there a full automated utility ? Do I need to check some data or schema before the migration ? Edit : I tried django-command-extensions DumpScript but it doesn't run on my 2GB RAM PC with my current DataSet. In my experience, dumping & restoring from SQL doesn't work properly. You should follow this sequence instead: 1. Dump db contents to json $ ./manage.py dumpdata > dump.json 2. Switch the backend in settings.py DATABASES = { # COMMENT OUT: