data-migration

How to include custom data migrations and static/reference data in an SSDT project?

落花浮王杯 提交于 2019-12-05 03:45:40
We have a moderately-sized SSDT project (~100 tables) that's deployed to dozens of different database instances. As part of our build process we generate a .dacpac file and then when we're ready to upgrade a database we generate a publish script and run it against the database. Some db instances are upgraded at different times so it's important that we have a structured process for these upgrades and versioning. Most of the generated migration script is dropping and (re)creating procs, functions, indexes and performing any structural changes, plus some data scripts included in a Post

How to make field enum migration yii2

…衆ロ難τιáo~ 提交于 2019-12-04 23:07:59
I make field ENUM and the result is error when I use yii migrate/up on CMD windows. public function up() { $tableOptions = null; if ($this->db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%user_social_media}}', [ 'social_media' => $this->ENUM('facebook', 'google', 'twitter', 'github'), 'id' => $this->primaryKey(), 'username' => $this->string(), 'user_id' => $this->integer(11), 'created_at' => $this->integer(11), 'updated_at' => $this->integer(11), ], $tableOptions); } Bizley There is no enum() method at the

Iphone data migration on application update

≡放荡痞女 提交于 2019-12-04 09:49:20
I am working on an iphone application that uses sqlite to store application and user data. This is the first version of the application and I wonder what I need to do to prepare for the future versions of the app. Is this enough? 1. Make sure app version is correct in the XCode Project settings 2. Add a version number in sqlite file so that it can be read later Lets simulate the next update! 1. New version of the app is downloaded to the device 2. The app reads the version number stored earlier in a sqlite table/field 3. App knows that application data has changed so it needs to update the

How can I send signals from within Django migrations?

左心房为你撑大大i 提交于 2019-12-04 02:57:57
问题 I use Django 1.7 migrations, and in particular, want to populate a newly-created database with initial data. Thus, I use a data migration for this. It looks like this: def populate_with_initial_data(apps, schema_editor): User = apps.get_model("auth", "User") new_user = User.objects.create(username="nobody") class Migration(migrations.Migration): ... operations = [ migrations.RunPython(populate_with_initial_data), ] At the same time, I want to have an instance of the UserDetails model for

How to migrate MySQL data directory in docker container?

谁都会走 提交于 2019-12-04 02:22:30
I have a docker container running MySQL-5.5 with host data volume. I am upgrading my container to MySQL-5.6. I am starting a new container with the same host volume. MySQL was crashing in the container due to the crash of mysql.user table. [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect key file for table 'user'; try to repair it 160523 12:04:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended I tried the following to fix that: root@container# mysqld --skip-grant-tables; root@container# mysql -uroot -ppassword mysql> repair table user USE_FRM; +-----------

Manually editing database in code first entity framework

一曲冷凌霜 提交于 2019-12-03 12:21:45
I have been trying out EF 4.1 ( code first ) with MVC 3. I am thinking ahead to when the application will need changes. I tested a couple of scenarios. I like the idea of manually editing the database when the model (my POCOs) would changed. ASP.NET error when I change the model : "The model backing the 'CTCMContext' context has changed since the database was created. Either manually delete/update the database..." Now, it says that I can " manually update the database ", but I did and still get the same error . Am I missing something !!?! EDIT Does this have to do with the model hash generate

Is there a Ruby database migration gem, that helps you move content from an old structure to a new structure?

醉酒当歌 提交于 2019-12-03 12:15:20
问题 Are there any Ruby gems/libraries that help you migrate from an old DB structure to a new structure? ActiveRecord migrations do a good job keeping track of a new db structure, but I wonder if there's something that helps you migrate an entire legacy db to a new structure: transfer_from(:source_table => 'person', :destination_table => 'dudes_and_dudets') do from :name, :to => :full_name from :dob, :to => :age do |dob| # this would, for example, load the result (Date.today - dob)/60/60/24/365 #

Realm migrations in Swift

倾然丶 夕夏残阳落幕 提交于 2019-12-03 11:56:14
问题 I have a Realm Object modeled as so class WorkoutSet: Object { // Schema 0 dynamic var exerciseName: String = "" dynamic var reps: Int = 0 // Schema 0 + 1 dynamic var setCount: Int = 0 } I am trying to perform a migration. Within my AppDelegate I have imported RealmSwift . Within the function didFinishLaunchWithOptions I call Migrations().checkSchema() Migrations is a class declared in another file. Within that file there is a struct declared as so. func checkSchema() { Realm.Configuration( /

How to add a new code-first migration with a newly-generated database?

ε祈祈猫儿з 提交于 2019-12-03 08:59:30
I've enabled code-first migrations on my entity framework project, and have added several migrations which do things like rename tables. However, I have now deleted the database and caused entity framework to generate a brand new database based on my latest data model. If I try to run: PM> Add-Migration TestMigration ... it tells me that I need to apply the existing migrations first. So I run: PM> Update-Database ... but the trouble is that it's trying to update a database that doesn't need updating; it's already based on the latest data model. So I get an error when it tries to rename a table

Migrating MySQL to PostgreSQL - what features not visible in SQL code will be important?

馋奶兔 提交于 2019-12-03 08:56:10
We're migrating MySQL to PostgreSQL. I can easily audit the schema and the SQL statements used throughout the (REALbasic) program. Most of the SQL is composed by building string variables. I already know about needing to replace our use of SELECT LAST_INSERT_ID() with a SERIAL column with UNIQUE constraint. What, if any , differences between the two which are not obviously visible in SQL statements might bite us? I'm looking for (probably subtle) assumptions about behaviour such as any differences in autocommit, need to add constraints which aren't in MySQL etc. I'm trying to tease out any