database-migration

Why does Django make migrations for help_text and verbose_name changes?

戏子无情 提交于 2019-11-29 02:49:27
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_initial.py ) manually and safely delete 0002_xxxx.py ? Is there a way to update previous migration

Migrate from MySQL to PostgreSQL on Linux (Kubuntu)

蓝咒 提交于 2019-11-29 02:16:32
问题 A long time ago on a system far, far away... Trying to migrate a database from MySQL to PostgreSQL. All the documentation I have read covers, in great detail, how to migrate the structure. I have found very little documentation on migrating the data. The schema has 13 tables (which have been migrated successfully) and 9 GB of data. MySQL version: 5.1.x PostgreSQL version: 8.4.x I want to use the R programming language to analyze the data using SQL select statements; PostgreSQL has PL/R, but

Error when doing rake db:migrate on Heroku

会有一股神秘感。 提交于 2019-11-29 01:20:44
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? 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.sql for a deployed app, so the best solution is to tell rails not to. Edit your Rakefile and override the

Error while upgrading Mongodb from 3.2 to 3.6

萝らか妹 提交于 2019-11-29 00:54:08
问题 I needed to upgrade mongodb from 3.2 to 3.6 in my environment. For the process i first migrated from 3.2 to 3.4 as recommended. After successful migration to 3.4, i started migration to 3.6 i am not able to start mongod. When checked log file i found error like: IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details. MY Mongod.conf systemLog: destination: file

Push database to heroku: how to use heroku pg:push

淺唱寂寞╮ 提交于 2019-11-28 23:30:45
I want to push my local postgresql database to heroku, using heroku pg:push command. The command looks like this: heroku pg:push mylocaldb DATABASE --app sushi according to the heroku document: https://devcenter.heroku.com/articles/heroku-postgresql . Here is my local database info: Name: mysitedb User: bill Password: bill The DATABASE_URL environment variable in my machine is set to: postgres://bill:bill@localhost/mysitedb . My app's name is secure-gorge-4090 . I tried heroku pg:push mysitedb DATABASE --app secure-gorge-4090 . The output was: ! Remote database is not empty. ! Please create a

FOSUserBundle: Custom password / Migration from old DB structure

社会主义新天地 提交于 2019-11-28 23:27:13
问题 I want to move to Symfony2, because I am totally impressed by its modernity and good programming. Now I am taking a users table from my old system, with 10,000 users, and I don't want to anger them by making them set a new password....so I want them to be able to login with their old password Here is pseudo-code of how my users table looks like with 3 major fields concerning login/signup: id, int(10) unsigned NOT NULL username varchar(40) NOT NULL passhash varchar(32) NOT NULL secret varchar

Add sql table column before or after specific other column - by migrations in Laravel 4.1

半世苍凉 提交于 2019-11-28 21:06:03
Table 'users': |id|name|address|post_code|deleted_at|created_at| and I want add column 'phone_nr' somewhere between 'id' and 'deleted_at' Is it possible by migrations in Laravel 4.1? James Binford Yes. Create a new migration using php artisan migrate:make update_users_table . Then use the table command as follows (if you're using MySQL!): Schema::table('users', function($table) { $table->string('phone_nr')->after('id'); }); Once you've finished your migration, save it and run it using php artisan migrate and your table will be updated. Documentation: https://laravel.com/docs/4.2/migrations

Dropping column with foreign key Laravel error: General error: 1025 Error on rename

馋奶兔 提交于 2019-11-28 20:59:37
I've created a table using migration like this: public function up() { Schema::create('despatch_discrepancies', function($table) { $table->increments('id')->unsigned(); $table->integer('pick_id')->unsigned(); $table->foreign('pick_id')->references('id')->on('picks'); $table->integer('pick_detail_id')->unsigned(); $table->foreign('pick_detail_id')->references('id')->on('pick_details'); $table->integer('original_qty')->unsigned(); $table->integer('shipped_qty')->unsigned(); }); } public function down() { Schema::drop('despatch_discrepancies'); } I need to change this table and drop the foreign

How do I add a check constraint in a Rails migration?

心已入冬 提交于 2019-11-28 20:58:52
问题 I need to add a new integer column to an existing table in my Rails app. The column can only have values 1, 2, 3, so I'd like to add a check constraint to the table/column. How do I specify this constraint within a Rails migration? 回答1: Rails migration does not provide any way to add Constraints, but you can still do it via migration but by passing actual SQL to execute() Create Migration file: ruby script/generate Migration AddConstraint Now, in the migration file: class AddConstraint <

Heroku run rake db:migrate results in no change in the database, app restarted several times

会有一股神秘感。 提交于 2019-11-28 20:39:29
I have a problem with pushing my migrations to the production database. The issue: I've altered database schema by adding 1 column. I've migrated it to the production database: MacBook-Air-Mac:app msc$ rake db:migrate RAILS_ENV="production" [RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it. == AddLengthColumnToBooks: migrating ========================================= -- add_column(:books, :length, :integer) -> 0.0017s == AddLengthColumnToBooks: migrated (0.0019s) ================================ Thinking that the new DB schema