migration

Rails app error - ActiveRecord::PendingMigrationError Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-05 13:35:46
问题 The database is created, tables are created, data are there. But after I restarted the Rails application, I got this error. The app is using MySQL. What's the issue here? Thank you in advance 回答1: Solution Simply run rake db:migrate There are migrations that need to be ran before your server can start. Learn what migrations are and how they are used in Rails with this RailsGuide. Run that rake db:migrate command any time you make a migration, or any time you create a new project. If you get

django-mptt raises django.db.utils.IntegrityError: null value in column “lft” violates not-null constraint

蹲街弑〆低调 提交于 2020-02-04 01:19:08
问题 Conditions: Django==1.8.7 и django-mptt==0.8.0. There is a model: class Tree(mptt_models.MPTTModel): name = models.CharField(max_length=120, unique=True) slug = models.SlugField(max_length=256, unique=True) parent = mptt_models.TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True) class MPTTMeta: order_insertion_by = ['name'] I can fill it with admin interface and show on a site pages. I can fill it with django shell: Python 2.7.3 (default, Jun 22 2015, 19:43

OperationalError: no such table

守給你的承諾、 提交于 2020-02-03 08:10:44
问题 So I was working on my app and added a slugfield to my models. Then as normal went ahead to makemigrations , and a massive red wall of errors appeared. Traceback (most recent call last): File "C:\Users\Andreas\ReaderProject\lib\site-packages\django\db\backends\utils.py", line 64, in execute return self.cursor.execute(sql, params) File "C:\Users\Andreas\ReaderProject\lib\site-packages\django\db\backends\sqlite3\base.py", line 337, in execute return Database.Cursor.execute(self, query, params)

AZURE - How to migrate resources from a tenant to another

旧巷老猫 提交于 2020-02-02 11:23:31
问题 I want to migrate resources (VMs, networks, gateways ...) from a tenant /client with a subscription to another tenant /client with another subscription, with the exact same parameters, how can I do that ? (the move function works only for subscriptions in the same tenant / client, if I download vhd of the VMs I must recreate manually the VMs configuration 回答1: The best and most reliable way is through Azure Billing Support. It is free support service and can handle that type of support

Django 1.8 Migration with Postgres BDR 9.4.1

限于喜欢 提交于 2020-02-02 04:22:53
问题 I am trying to run Django migrations on a Postgres database with BDR. python manage.py makemigrations works fine, but running python manage.py migrate results in the following error: ALTER TABLE … ALTER COLUMN TYPE … may only affect UNLOGGED or TEMPORARY tables when BDR is active; auth_permission is a regular table The offending module is django/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py . I am not finding anything on how to UNLOGGED tables using Django,

Django 1.8 Migration with Postgres BDR 9.4.1

与世无争的帅哥 提交于 2020-02-02 04:21:10
问题 I am trying to run Django migrations on a Postgres database with BDR. python manage.py makemigrations works fine, but running python manage.py migrate results in the following error: ALTER TABLE … ALTER COLUMN TYPE … may only affect UNLOGGED or TEMPORARY tables when BDR is active; auth_permission is a regular table The offending module is django/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py . I am not finding anything on how to UNLOGGED tables using Django,

Laravel Migrations - Issues while creating timestamps

喜你入骨 提交于 2020-01-31 03:19:09
问题 I am trying to run migrations on my Laravel instance. They are just the default migrations (users and password resets) but when it tries to make the timestamps it throws this error: [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table ` users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) n ot null, `password` varchar(60) not null,

How to migrate GCP instances to AWS?

ぐ巨炮叔叔 提交于 2020-01-30 08:14:09
问题 I'm trying to migrate GCP instances to AWS, I have been searching for the solution but didn't find any references. Could you please help me with this. 回答1: The OS are customized differently in different cloud, so you can only migrate files and applications, by using Cloud Storage or AWS S3 as the bridge to migration files While for the applications, you're recommended to build from scratch, but it highly depends on what exactly you want to migrate 来源: https://stackoverflow.com/questions

Rails: Adding an index after adding column

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-28 13:18:48
问题 Suppose I created a table table in a Rails app. Some time later, I add a column running: rails generate migration AddUser_idColumnToTable user_id:string. Then I realize I need to add user_id as an index. I know about the add_index method, but where should this method be called? Am I supposed to run a migration (if yes, which one ?), then adding by hand this method? 回答1: You can run another migration, just for the index: class AddIndexToTable < ActiveRecord::Migration def change add_index

Rails: Adding an index after adding column

↘锁芯ラ 提交于 2020-01-28 13:17:28
问题 Suppose I created a table table in a Rails app. Some time later, I add a column running: rails generate migration AddUser_idColumnToTable user_id:string. Then I realize I need to add user_id as an index. I know about the add_index method, but where should this method be called? Am I supposed to run a migration (if yes, which one ?), then adding by hand this method? 回答1: You can run another migration, just for the index: class AddIndexToTable < ActiveRecord::Migration def change add_index