博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
migrate
阅读量:6195 次
发布时间:2019-06-21

本文共 10581 字,大约阅读时间需要 35 分钟。

数据类型 引用# :string, :text, :integer, :float,:decimal, :datetime, :timestamp, :time, :date,# :binary, :boolean 与db有关的rake任务  db:charset 检索当前环境下数据库的字符设置 db:collation 检索当前环境下数据库的校对 db:create 用config\database.yml中的定义创建当前 RAILS_ENV 项目环境下的数据库 db:create:all 用config\database.yml中的定义创建所有数据库 db:drop 删除当前 droRAILS_ENV项目环境中的数据库 db:drop:all 删除所有在 config\database.yml中定义的数据库 db:reset 从db\schema.rb中为当前环境重建数据库(先删后建). db:rollback 回滚(清华出版社一本SQLSERVER书的名词[很奇怪为什么不直接用滚回])数据库到前一个版本. 指定回滚到哪一步要用 STEP=n 参数db:version 检索当前模式下的版本 备份数据库rake db:backup:create 根据database.yml的信息备份数据库rake db:backup:destroy 默认删除一天前的备份数据rake db:backup:rebuild 默认恢复最新的备份数据注意:这里设置的备份目录是db的backup目录,可以修改 添加索引 引用add_index :acls, ["action_id","group_id"],:unique=>true add_index :acls, :action_id drop all tables 删除全部表rake db:migrate VERSION=0 指定恢复/删除:rake db:migrate:down/up VERSION = version_of_migrati定义数字精确度 t.integer :total_price, :precision=>8,:scale=>2,:default=>0db:create creates the database for the current envdb:create:all creates the databases for all envsdb:drop drops the database for the current envdb:drop:all drops the databases for all envsdb:migrate runs migrations for the current env that have not run yetdb:migrate:up runs one specific migrationdb:migrate:down rolls back one specific migrationdb:migrate:status shows current migration statusdb:rollback rolls back the last migrationdb:forward advances the current schema version to the next onedb:seed (only) runs the db/seed.rb filedb:schema:load loads the schema into the current env's databasedb:schema:dump dumps the current env's schema (and seems to create the db as well)db:setup runs db:schema:load, db:seeddb:reset runs db:drop db:setupdb:migrate:redo runs (db:migrate:down db:migrate:up) or (db:rollback db:migrate) depending on the specified migrationdb:migrate:reset runs db:drop db:create db:migraterake db:abort_if_pending_migrations                 # Raises an error if there are pending migrationsrake db:charset                                                       # Retrieves the charset for the current environment's databaserake db:collation                                                     # Retrieves the collation for the current environment's databaserake db:create                                                         # Create the database defined in config/database.yml for the current RAILS_ENVrake db:create:all                                                   # Create all the local databases defined in config/database.ymlrake db:drop                                                             # Drops the database for the current RAILS_ENVrake db:drop:all                                                       # Drops all the local databases defined in config/database.ymlrake db:fixtures:identify                                           # Search for a fixture given a LABEL or ID.rake db:fixtures:load                                             # Load fixtures into the current environment's database.rake db:migrate                                                       # Migrate the database through scripts in db/migrate.rake db:migrate:down                                          # Runs the "down" for a given migration VERSION.rake db:migrate:redo                                           # Rollbacks the database one migration and re migrate up.rake db:migrate:reset                                           # Resets your database using your migrations for the current environmentrake db:migrate:up                                              # Runs the "up" for a given migration VERSION.rake db:reset                                                       # Drops and recreates the database from db/schema.rb for the current environment.rake db:rollback                                                   # Rolls the schema back to the previous version.rake db:schema:dump                                      # Create a db/schema.rb file that can be portably used against any DB supported by ARrake db:schema:load                                     # Load a schema.rb file into the databaserake db:sessions:clear                                  # Clear the sessions tablerake db:sessions:create                               # Creates a sessions migration for use with CGI::Session::ActiveRecordStorerake db:structure:dump                              # Dump the database structure to a SQL filerake db:test:clone                                          # Recreate the test database from the current environment's database schemarake db:test:clone_structure                         # Recreate the test databases from the development structurerake db:test:load                                             # Recreate the test database from the current schema.rbrake db:test:prepare                                     # Check for pending migrations and load the test schemarake db:test:purge                                       # Empty the test databaserake db:version                                 # Retrieves the current schema version numberrake doc:app                        # Build the app HTML Filesrake doc:clobber_app                         # Remove rdoc productsrake doc:clobber_plugins                        # Remove plugin documentationrake doc:clobber_rails                             # Remove rdoc productsrake doc:guides                                      # Generate Rails guidesrake doc:plugins                                    # Generate documentation for all installed pluginsrake doc:rails                                         # Build the rails HTML Filesrake doc:reapp                                       # Force a rebuild of the RDOC filesrake doc:rerails                                     # Force a rebuild of the RDOC filesrake gems                                               # List the gems that this rails application depends onrake gems:build                                 # Build any native extensions for unpacked gemsrake gems:install                                         # Installs all required gems for this application.rake gems:refresh_specs                                 # Regenerate gem specifications in correct format.rake gems:unpack                                           # Unpacks the specified gem into vendor/gems.rake gems:unpack:dependencies                                # Unpacks the specified gems and its dependencies into vendor/gemsrake log:clear                                                        # Truncates all *.log files in log/ to zero bytesrake notes                                   # Enumerate all annotationsrake notes:custom                                     # Enumerate a custom annotation, specify with ANNOTATION=WTFHAXrake notes:fixme                                       # Enumerate all FIXME annotationsrake notes:optimize                                       # Enumerate all OPTIMIZE annotationsrake notes:todo                                                  # Enumerate all TODO annotationsrake rails:freeze:edge                                         # Lock to latest Edge Rails, for a specific release use RELEASE=1.2.0rake rails:freeze:gems                                       # Lock this application to the current gems (by unpacking them into vendor/rails)rake rails:unfreeze                                  # Unlock this application from freeze of gems or edge and return to a fluid use of system gemsrake rails:update                                          # Update both configs, scripts and public/javascripts from Railsrake rails:update:configs                                    # Update config/boot.rb from your current rails installrake rails:update:javascripts                                   # Update your javascripts from your current rails installrake rails:update:scripts                                    # Add new scripts to the application script/ directoryrake routes                                                      # Print out all defined routes in match order, with names.rake secret                                               # Generate a crytographically secure secret key.rake stats                                   # Report code statistics (KLOCs, etc) from the applicationrake test                                               # Run all unit, functional and integration testsrake test:benchmark                                # Run tests for benchmarkdb:test:prepare / Benchmark the performance testsrake test:functionals                                    # Run tests for functionalsdb:test:prepare / Run the functional tests in test/functionalrake test:integration                                    # Run tests for integrationdb:test:prepare / Run the integration tests in test/integrationrake test:plugins                                             # Run tests for pluginsenvironment / Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)rake test:profile                                              # Run tests for profiledb:test:prepare / Profile the performance testsrake test:recent                                        # Run tests for recentdb:test:prepare / Test recent changesrake test:uncommitted                                    # Run tests for uncommitteddb:test:prepare / Test changes since last checkin (only Subversion and Git)rake test:units                                      # Run tests for unitsdb:test:prepare / Run the unit tests in test/unitrake time:zones:all                                   # Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset.rake time:zones:local                                    # Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local timerake time:zones:us                                    # Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset.rake tmp:cache:clear                                  # Clears all files and directories in tmp/cacherake tmp:clear                                               # Clear session, cache, and socket files from tmp/rake tmp:create                                               # Creates tmp directories for sessions, cache, and socketsrake tmp:pids:clear                                                # Clears all files in tmp/pidsrake tmp:sessions:clear                                          # Clears all files in tmp/sessionsrake tmp:sockets:clear                                             # Clears all files in tmp/sockets

 

转载于:https://www.cnblogs.com/znsongshu/p/6080187.html

你可能感兴趣的文章
运维资产管理系统cmdb对实施自动化运维的重要性
查看>>
虚拟化整合实现1+1大于2的效果
查看>>
前端代码标准最佳实践:HTML篇
查看>>
优易联 -- 项目拨付款管理系统
查看>>
技术改变生活——电影目录核对工具(php)
查看>>
Sed one line
查看>>
OpenInventor笔记:线性坐标轴PoLinearAxis的使用
查看>>
[转]ORACLE函数大全
查看>>
Unsupported compiler 'GCC 4.2' selected for architecture 'i386'
查看>>
修改Xcode配置并支持iPhone上dylib工程 实例
查看>>
iphone-命令行编译--xcodebuild
查看>>
java keytool证书工具使用小结
查看>>
全新的PDO数据库操作类(仅适用Mysql)
查看>>
ImportError: No module named setuptools 解决方案
查看>>
Microsoft Team Foundation Server 2010 安装 序列号 注册码
查看>>
转 OFBiz安全组
查看>>
WMI服务故障,VBS脚本无法运行错误
查看>>
常见充值方式介绍及对比
查看>>
2012最新75款好看的英文字体免费下载【中篇】
查看>>
SilverLight学习笔记--进一步学习Isolated Storage独立存储一(理论篇)
查看>>