database-migration

NOTICES for sequence after running migration in rails on postgresql Application

南楼画角 提交于 2019-11-28 05:45:57
When i run my migration in Rails application on postgresql i got following NOTICES NOTICE: CREATE TABLE will create implicit sequence "notification_settings_id_seq" for serial column "notification_settings.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "notification_settings_pkey" for table "notification_settings" My migration file contains 088_create_notification_settings.rb class CreateNotificationSettings < ActiveRecord::Migration def self.up create_table :notification_settings do |t| t.integer :user_id t.integer :notification_id t.boolean :notification_on t.boolean

Programmatic data transformation in EF5 Code First migration

陌路散爱 提交于 2019-11-28 05:02:56
问题 Is it possible to do any type of programmatic data transformation in Entity Framework 5 Code First migrations? There is an Sql () method to execute queries, but it has return type void and I don't see any way to get the results of the queries I perform. Example I have table Recipe with one-to-many relationship to Ingredient . For various reasons I want to convert this to a Ingredients JSON string property instead. The only approach I can think of is something like this: Create new column

MySQL columns with DEFAULT NULL - stylistic choice, or is it?

十年热恋 提交于 2019-11-28 02:35:59
问题 In many flavors of SQL, there are three ways you can implicitly set a column to NULL on every row insertion. These are: columnname type NULL columnname type DEFAULT NULL columnname type NULL DEFAULT NULL I.e. the first one sets the NULL flag (as opposed to NOT NULL), second one leaves the NULL flag to the default value, and the third one sets the NULL flag and sets the implicit value as NULL. I've heard about how in Microsoft SQL, the second variation is not exactly the same since you can

Sequelize.js: how to use migrations and sync

喜夏-厌秋 提交于 2019-11-28 02:33:24
I'm close to having my project ready to launch. I have big plans for after launch and the database structure is going to change -- new columns in existing tables as well as new tables, and new associations to existing and new models. I haven't touched migrations in Sequelize yet, since I've only had testing data which I don't mind wiping out every time the database changes. To that end, at present I'm running sync force: true when my app starts up, if I have changed the model definitions. This deletes all the tables and makes them from scratch. I could omit the force option to have it only

EF Migrations: Rollback last applied migration?

て烟熏妆下的殇ゞ 提交于 2019-11-28 02:31:59
This looks like a really common task, but I can't find an easy way to do it. I want to undo the last applied migration. I would have expected a simple command, like PM> Update-Database -TargetMigration:"-1" Instead, all I can come up with is: PM> Get-Migrations Retrieving migrations that have been applied to the target database. 201208012131302_Add-SystemCategory 201207311827468_CategoryIdIsLong 201207232247409_AutomaticMigration 201207211340509_AutomaticMigration 201207200025294_InitialCreate PM> Update-Database -TargetMigration:"CategoryIdIsLong" (At least I can use just the name, skipping

EF Migrations for Database-first approach?

冷暖自知 提交于 2019-11-27 22:54:27
问题 We're using Database first approach with EntityFramework. We've several customers, and when we deploy new product version, we're now applying DB schema changes "manually" with tools like SQL Compare . Is there a way how EF Migrations could help to apply changes to customers DB automatically? 回答1: As far as I know, EF Migrations is a product targeted at CodeFirst and doesn't support Database First operations. CodeFirst assumes that you will never make any changes manually to the database. All

Creating MYSQL Procedure in Laravel 4 Migrations

大兔子大兔子 提交于 2019-11-27 22:11:57
Is there a way to generate stored MYSQL procedures in a Laravel 4 migration? For example, here's a simple procedure generation query stored as a string (via a Heredoc ) $query = <<<SQL DELIMITER $$ DROP PROCEDURE IF EXISTS test$$ CREATE PROCEDURE test() BEGIN INSERT INTO `test_table`(`name`) VALUES('test'); END$$ DELIMITER ; SQL; DB:statement(DB::RAW($query)); When Running this in a migration's up() function I get this error: There are two major problems with your code DELIMITER is not a valid sql statement. It's just a MySql client command. So just don't use it. BTW the error you get tells

Error when doing rake db:migrate on Heroku

梦想与她 提交于 2019-11-27 21:36:28
问题 when doing heroku run rake db:migrate all migrations are performed and then, at the end I always get following message: /app/vendor/bundle/ruby/1.9.1/bin/rake: No such file or directory - pg_dump -i -s -x -O -f /app/db/structure.sql dan79p98fykovu I can't add pg_dump to PATH on Heroku. How to deal with this? 回答1: The issue is that rails is trying to dump a new structure.sql once the migration is complete, and failing because pg_dump is not present. It's pointless to generate a new structure

No connection string named 'MyApplicationEntities' could be found in the application config file

风流意气都作罢 提交于 2019-11-27 19:36:26
I just install EF 4.3 and trying to upgrade my project with migration. however I am getting issues with trying to execute add-migration initial to my project via Package Manager console. It is throwing any exception now No connection string named 'MyApplicationEntities' could be found in the application config file. Now my config has it all <connectionStrings> <add name="MyApplicationEntities" connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog

Why does Django make migrations for help_text and verbose_name changes?

夙愿已清 提交于 2019-11-27 17:06:36
问题 When I change help_text or verbose_name for any of my model fields and run python manage.py makemigrations , it detects these changes and creates a new migration, say, 0002_xxxx.py . I am using PostgreSQL and I think these changes are irrelevant to my database (I wonder if a DBMS for which these changes are relevant exists at all). Why does Django generate migrations for such changes? Is there an option to ignore them? Can I apply the changes from 0002_xxxx.py to the previous migration ( 0001