migrate

How to force migrations to a DB if some tables already exist in Django?

谁都会走 提交于 2020-05-09 20:27:27
问题 I have a Python/Django proyect. Due to some rolls back, and other mixed stuff we ended up in a kind of odd scenario. The current scenario is like this: DB has the correct tables DB can't be rolled back or dropped Code is up to date Migrations folder is behind the DB by one or two migrations. (These migrations were applied from somewhere else and that "somewhere else" doesn't exist anymore) I add and alter some models I run makemigrations New migrations are created, but it's a mix of new

Laravel php artisan migrate not working

若如初见. 提交于 2020-03-18 15:20:32
问题 When I try to use 'php artisan migrate' in Laravel I get 2 errors: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database (SQL: select * from sqlite_master where type = 'table' and name = migrations) [PDOException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database I created a storage/database.sqlite file before attempting the migration. I also edited the config/database.php, making the default=sqlite . I am using

Doing a Laravel tutorial, getting “Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist”

六眼飞鱼酱① 提交于 2020-01-14 02:31:10
问题 Working through this tutorial, I'm down to the following step: You should now be able to call migrate as many times as you want and it’ll work: php artisan migrate:refresh Upon running that command, I get the following errors: [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist (SQL: select max( batch ) as aggregate from migrations ) [PDOException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd

AppBarLayout inflating error after migrating to AndroidX

北战南征 提交于 2020-01-12 07:47:26
问题 When migrating to AndroidX I faced this problem: Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mandarine.android/com.mandarine.android.features.root.RootActivity}: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class android.support.design.widget.AppBarLayout 回答1: Unless you implement the old support libraries and enable Jetifier, you have to rename all your support classes in XML. android.support.design.widget

invalid literal for int() with base 10 - django - updated

谁说胖子不能爱 提交于 2020-01-03 18:35:38
问题 I am a django beginner, and I am trying to make a child-parent like combo box, (bars depends on city depends on country) and I get this error. UPDATE: Changed the model and the default value for the foreign key, but still the same error. Any help? thanks! this is models.py: from django.db import models from smart_selects.db_fields import ChainedForeignKey DEFAULT_COUNTRY_ID = 1 # id of Israel class BarName(models.Model): name = models.CharField(max_length=20) def __unicode__(self): return

Meteor how to perform database migrations?

点点圈 提交于 2019-12-31 08:29:09
问题 How do you perform database migrations with Meteor? With Ruby on Rails there is ActiveRecord::Migration. Is there an equivalent mechanism in Meteor? For example, I make an app with some user data. I'm storing the data in Mongo using a JSON format. The app changes, and the JSON database schema needs to change. I can write a migration method to change the schema, however, I only want this to run if the server database is out of date. 回答1: There's nothing built in for this. What I've done myself

Renaming models(tables) in Django

人走茶凉 提交于 2019-12-30 08:22:06
问题 so I've already created models in Django for my db, but now want to rename the model. I've change the names in the Meta class and then make migrations/migrate but that just creates brand new tables. I've also tried schemamigration but also not working, I'm using Django 1.7 Here's my model class ResultType(models.Model): name = models.CharField(max_length=150) ut = models.DateTimeField(default=datetime.now) class Meta: db_table = u'result_type' def __unicode__(self): return self.name Cheers

Renaming models(tables) in Django

旧城冷巷雨未停 提交于 2019-12-30 08:21:10
问题 so I've already created models in Django for my db, but now want to rename the model. I've change the names in the Meta class and then make migrations/migrate but that just creates brand new tables. I've also tried schemamigration but also not working, I'm using Django 1.7 Here's my model class ResultType(models.Model): name = models.CharField(max_length=150) ut = models.DateTimeField(default=datetime.now) class Meta: db_table = u'result_type' def __unicode__(self): return self.name Cheers

Django: dependencies reference nonexistent parent node

旧街凉风 提交于 2019-12-30 03:40:27
问题 When I run the following command python manage.py migrate I receive this error from django so can't step forward in my practice: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/nikhil/testWeb-devEnv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/home/nikhil/testWeb-devEnv/local/lib/python2.7/site-packages/django/core/management/_

Migrate from one django model to two models referenced with a foreign key

流过昼夜 提交于 2019-12-25 09:42:20
问题 I need to outsource some of the attribues in the following Django model: class TextResult(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1) text = models.ForeignKey(Text) # following fields will be in the referenced model wpm = models.FloatField(default=0.0) accuracy = models.FloatField(default=1.0, validators=[MinValueValidator(0.0), MaxValueValidator(1.0)]) to a model, that references to the specific data: class TextResult(models.Model): user = models.ForeignKey