database-migration

Rails migration does not change schema.rb

大憨熊 提交于 2019-11-28 20:09:44
问题 I have a rails migration that is not being applied to my schema.rb. The migration should create a table: class CreateUserGraphs < ActiveRecord::Migration def change create_table :user_graphs do |t| t.string :name t.string :content t.integer :user_id t.string :type_id t.integer :upload_id t.timestamps end add_index :user_graphs, [:user_id, :created_at] end end I did db:reset. Then I tried rake db:migrate:up VERSION=123123123(this is the migration #). I am in my "dev" environment. Why is the

“Error loading plugin manager: TomcatGrailsPlugin” on Grails 2.3 Database Migration

我是研究僧i 提交于 2019-11-28 18:59:47
I use Grails 2.3 and the Grails database migration plugin (1.3.6). When I do grails dbm-update I get the following error. How can I solve this error? Error Error loading plugin manager: TomcatGrailsPlugin (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) java.lang.ClassNotFoundException: TomcatGrailsPlugin at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:40) at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185) at

django.db.migrations.exceptions.InconsistentMigrationHistory

折月煮酒 提交于 2019-11-28 16:41:33
When i run python manage.py migrate on my django project, i gets the following error Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/home/hari/project/env/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 363, in execute_from_command_line utility.execute() File "/home/hari/project/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/hari/project/env/local/lib/python2.7/site-packages/django

Room database migration if only new table is added

和自甴很熟 提交于 2019-11-28 15:57:14
Let't assume, I have a simple Room database: @Database(entities = {User.class}, version = 1) abstract class AppDatabase extends RoomDatabase { public abstract Dao getDao(); } Now, I'm adding a new entity: Pet and bumping version to 2: @Database(entities = {User.class, Pet.class}, version = 2) abstract class AppDatabase extends RoomDatabase { public abstract Dao getDao(); } Of course, Room throws an exception: java.lang.IllegalStateException: A migration from 1 to 2 is necessary. Assuming, I haven't changed User class (so all data is safe), I have to provide migration which just creates a new

How do I move a redis database from one server to another?

◇◆丶佛笑我妖孽 提交于 2019-11-28 15:01:38
I currently have a live redis server running on a cloud instance and I want to migrate this redis server to a new cloud instance and use that instance as my new redis server. If it were MySQL, I would export the DB from the old server and import it into the new server. How should I do this with redis? P.S.: I'm not looking to set-up replication. I want to completely migrate the redis server to a new instance. Anurag Save a snapshot of the database into a dump.rdb by either running BGSAVE or SAVE from the command line. This will create a file named dump.rdb in the same folder as your redis

ProgrammingError: relation 'blah blah' does not exist, trying to run the specific migration and get error

岁酱吖の 提交于 2019-11-28 14:38:51
I am getting an error: $ python manage.py migrate swsite 0023_hitcounter.py Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv self.execute(*args, *

Ruby on Rails: How can I revert a migration with rake db:migrate?

元气小坏坏 提交于 2019-11-28 14:24:00
问题 After installing devise MODEL User i got this. class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null => false t.recoverable t.rememberable t.trackable # t.encryptable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.token_authenticatable t.timestamps end add_index :users, :email, :unique => true add_index :users, :reset_password_token, :unique => true # add_index :users,

Problems setting a custom primary key in a Rails 4 migration

与世无争的帅哥 提交于 2019-11-28 10:18:05
I use postgresql 9.3, Ruby 2.0, Rails 4.0.0. After reading numerous questions on SO regarding setting the Primary key on a table, I generated and added the following migration: class CreateShareholders < ActiveRecord::Migration def change create_table :shareholders, { id: false, primary_key: :uid } do |t| t.integer :uid, limit: 8 t.string :name t.integer :shares t.timestamps end end end I also added self.primary_key = "uid" to my model. The migration runs successfully, but when I connect to the DB using pgAdmin III I see that the uid column is not set as primary key. What am I missing?

Entity Framework 4.3 - TPH mapping and migration error

不问归期 提交于 2019-11-28 09:19:21
I'm using Entity Framework 4.3 with code first and manual migrations. I'm trying to map a TPH (table-per-hierarchy) setup which uses two custom discriminator fields. One for the discriminator itself and the other for soft deletes (much like the "where" option in NH class mappings). The exact same setup works just fine in another project which runs on EF 4.2. I get the error when trying to add a migration using the "add-migration" command in the NuGet console. I have tried all combinations of defining the table name - attributes on class, in "OnModelCreating" method, in EntityTypeConfiguration

Room Persistence Library: Weird Error during migration

徘徊边缘 提交于 2019-11-28 08:44:21
问题 I am scratching my head with this error. I couldn't find any answer so far. I have old database which I am migrating to Persistence Room library. However whenever I do migration, I am getting following error, java.lang.IllegalStateException: Migration didn't properly handle. Code I am using is as follows: @Entity(tableName = ROUTE_TABLE) public class RouteData { static final String ROUTE_TABLE = "name"; @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") private int id; @ColumnInfo(name