data-migration

How (and whether) to populate rails application with initial data

寵の児 提交于 2019-11-27 16:47:22
I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database. After asking this question , it seems that I should be using db:schema:load, rather than running the migrations, to set up fresh databases on new development machines. Unfortunately, this doesn't seem to include the migrations which insert data, only those which set up tables, keys etc. My

Insert data and set foreign keys with Postgres

狂风中的少年 提交于 2019-11-27 14:45:59
I have to migrate a large amount of existing data in a Postgres DB after a schema change. In the old schema a country attribute would be stored in the users table. Now the country attribute has been moved into a separate address table: users: country # OLD address_id # NEW [1:1 relation] addresses: id country The schema is actually more complex and the address contains more than just the country. Thus, every user needs to have his own address (1:1 relation). When migrating the data, I'm having problems setting the foreign keys in the users table after inserting the addresses: INSERT INTO

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

左心房为你撑大大i 提交于 2019-11-27 08:58:28
问题 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. 回答1: Save a snapshot of the database into a dump.rdb by either running BGSAVE or

What is your favorite solution for managing database migrations in django? [closed]

对着背影说爱祢 提交于 2019-11-27 06:30:37
I quite like Rails' database migration management system. It is not 100% perfect, but it does the trick. Django does not ship with such a database migration system (yet?) but there are a number of open source projects to do just that, such as django-evolution and south for example. So I am wondering, what database migration management solution for django do you prefer? (one option per answer please) I've been using South , but Migratory looks promising as well. Migratory looks nice and simple. We use Django at work, and we've been using dmigrations . While it has its quirks, it's been useful

Dealing with schema changes in Mongoose

血红的双手。 提交于 2019-11-27 06:26:30
What's the best practice (or tool) for updating/migrating Mongoose schemas as the application evolves? Update: Tested, this does not work in its current form, its got the right idea going, I got a single migration to work with considerable tweaking of the module itself. But I don't see it working as intended without some major changes and keeping track of the different schemas somehow. Sounds like you want mongoose-data-migrations It is intended to migrate old schema versions of your documents as you use them, which is seems to be the best way to handle migrations in mongodb. You don't really

Exporting from SQLite to SQL Server

放肆的年华 提交于 2019-11-27 05:32:58
问题 Is there a tool to migrate an SQLite database to SQL Server (both the structure and data)? 回答1: 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. 回答2: I know that this is old thread, but I think that this solution should be also here. Install ODBC driver

What is the best approach to change primary keys in an existing Django app?

南笙酒味 提交于 2019-11-27 04:02:52
I have an application which is in BETA mode. The model of this app has some classes with an explicit primary_key. As a consequence Django use the fields and doesn't create an id automatically. class Something(models.Model): name = models.CharField(max_length=64, primary_key=True) I think that it was a bad idea (see unicode error when saving an object in django admin ) and I would like to move back and have an id for every class of my model. class Something(models.Model): name = models.CharField(max_length=64, db_index=True) I've made the changes to my model (replace every primary_key=True by

How to move Jenkins from one PC to another

风格不统一 提交于 2019-11-26 23:34:36
I am currently using Jenkins on my development PC. I installed it on my development PC, because I had limited knowledge on this tool; so I tested on it in my development PC. Now, I feel comfortable with Jenkins as my long term "partner" in the build process and would like to "move" this Jenkins to a dedicated server. Before this I have done few builds and have the artifacts archived from each build. In particular, the build number is very important to me for version control. How can I export all the Jenkins information from my current PC to my new server? Cédric Julien Following the Jenkins

How to implement IDbContextFactory for use with Entity Framework data migrations

穿精又带淫゛_ 提交于 2019-11-26 22:47:14
问题 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

Steps to migrate Core Data databases for shipped iPhone apps

╄→尐↘猪︶ㄣ 提交于 2019-11-26 21:23:28
问题 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? 回答1: 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