yarn启动包括下载有写命令报错404 例如:yarn create umi,具体报错信息
G:\>tyarn create umi
yarn create v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/flatmap-stream/-/flatmap-stream-0.1.0.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Lenovo\\AppData\\Local\\Yarn\\Data\\global\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
且umi已经用cnpm下载完成了,之前用yarn也下载不下来
首先用你想要的任何名字生成一个空的迁移。这样做很重要,因为它会创建适当的日期。
rails generate migration DropProductsTable
这将在/ db / migrate中生成一个.rb文件,如20111015185025_drop_products_table.rb
现在编辑该文件看起来像这样:
class DropProductsTable < ActiveRecord::Migration
def up
drop_table :products
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
我唯一添加的是drop_table :products和raise ActiveRecord::IrreversibleMigration。
然后运行rake db:migrate,就可以了!!
。你可以创建一个空的迁移,然后用你需要的代码填充它。
您可以在这里找到有关如何完成不同任务的信息:
http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
更具体地说,您可以看到如何使用以下方法删除表:
drop_table :table_name