When running rake DB: migrate, you sometimes find an error in rake abort. Rake says that a table already exists, so it can’t do the work of this migrate. This table does exist, so how can rake skip this table or force it to be overridden?There is one area that needs to be modified:
Original migrate file:
Ruby code
- class CreateProducts & lt; ActiveRecord::Migration def self.up create_ table : products do | t| t.column : title, : string t.column : description, : text t.column : image_ url, : string end end def self.down drop_ table : products end end ol>
Modified migrate file:
Ruby code
- class CreateProducts & lt; ActiveRecord::Migration def self.up create_ table : products, : force =& gt; true do | t| t.column : title, : string t.column : description, : text t.column : image_ url, : string end end def self.down drop_ table : products end end ol>
Do you see that in create_ In the parameter of table, add: force = & gt; True.
Read More:
- Django. DB. Utils. Programmingerror: (1146, “table * doesn’t exist”) causes and Solutions
- mysql Table ‘performance_ schema.session_ Variables’ doesn’t exist solution
- Error 1146 (42s02): table ‘database name. Table name’ doesn’t exist ‘
- An error occurred when opensips started the service“ ERROR:core :db_ check_ table_ Version: invalid version 7 for Table dialog found “
- DB2 table annotation pull
- 1072 – Key column ‘xxx_id’ doesn’t exist in table
- DB2 encountered the problem of sqlcode = 911 lock table when updating record update
- django.db.utils.OperationalError: no such table: django_admin_log
- DB2 create table error – 104 42601 illegal symbol encountered in SQL statement
- db2 Database Error: table space access is not allowed
- MySQL – ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist
- Table ‘sell.hibernate_sequence‘ doesn‘t exist
- SAP Migo 101 receives the work order and reports an error – check table tfbefu_ CR entry 10 does not exist – Countermeasures
- SAP mm receives the purchase order and reports an error – table t169p entry znmi does not exist-
- In the SQL query statement, add the column that does not exist in the table and set the fixed value of the column
- Error pathvariable annotation was empty on param 0 when migrating idea to eclipse
- (element UI component table) how to add a style to a table
- 1093 – You can’t specify target table ‘table’ for update in FROM clause
- Cause analysis and solution of “SVN: e155009: failed to run the WC DB work queue associated with”
- A case diagnosis and solution of DB2 error code 1639 and SQL state 08001 is described in detail