1. 数据类型
  2. 引用
  3. # :string, :text, :integer, :float,:decimal, :datetime, :timestamp, :time, :date,
  4. # :binary, :boolean
  5.  
  6. db有关的rake任务
  7.  
  8. db:charset 检索当前环境下数据库的字符设置
  9. db:collation 检索当前环境下数据库的校对
  10. db:create config\database.yml中的定义创建当前 RAILS_ENV 项目环境下的数据库
  11. db:create:all config\database.yml中的定义创建所有数据库
  12. db:drop 删除当前 droRAILS_ENV项目环境中的数据库
  13. db:drop:all 删除所有在 config\database.yml中定义的数据库
  14. db:reset db\schema.rb中为当前环境重建数据库(先删后建).
  15. db:rollback 回滚(清华出版社一本SQLSERVER书的名词[很奇怪为什么不直接用滚回])数据库到前一个版本. 指定回滚到哪一步要用 STEP=n 参数
  16. db:version 检索当前模式下的版本
  17.  
  18. 备份数据库
  19. rake db:backup:create 根据database.yml的信息备份数据库
  20. rake db:backup:destroy 默认删除一天前的备份数据
  21. rake db:backup:rebuild 默认恢复最新的备份数据
  22.  
  23. 注意:这里设置的备份目录是dbbackup目录,可以修改
  24.  
  25. 添加索引
  26. 引用
  27.  
  28. add_index :acls, ["action_id","group_id"],:unique=>true
  29. add_index :acls, :action_id
  30.  
  31. drop all tables 删除全部表
  32. rake db:migrate VERSION=0
  33.  
  34. 指定恢复/删除:
  35. rake db:migrate:down/up VERSION = version_of_migrati
  36.  
  37. 定义数字精确度
  38. t.integer :total_price, :precision=>8,:scale=>2,:default=>0
  39.  
  40. db:create creates the database for the current env
  41. db:create:all creates the databases for all envs
  42. db:drop drops the database for the current env
  43. db:drop:all drops the databases for all envs
  44. db:migrate runs migrations for the current env that have not run yet
  45. db:migrate:up runs one specific migration
  46. db:migrate:down rolls back one specific migration
  47. db:migrate:status shows current migration status
  48. db:rollback rolls back the last migration
  49. db:forward advances the current schema version to the next one
  50. db:seed (only) runs the db/seed.rb file
  51. db:schema:load loads the schema into the current env's database
  52. db:schema:dump dumps the current env's schema (and seems to create the db as well)
  53. db:setup runs db:schema:load, db:seed
  54. db:reset runs db:drop db:setup
  55. db:migrate:redo runs (db:migrate:down db:migrate:up) or (db:rollback db:migrate) depending on the specified migration
  56. db:migrate:reset runs db:drop db:create db:migrate
  57.  
  58. rake db:abort_if_pending_migrations # Raises an error if there are pending migrations
  59. rake db:charset # Retrieves the charset for the current environment's database
  60. rake db:collation # Retrieves the collation for the current environment's database
  61. rake db:create # Create the database defined in config/database.yml for the current RAILS_ENV
  62. rake db:create:all # Create all the local databases defined in config/database.yml
  63. rake db:drop # Drops the database for the current RAILS_ENV
  64. rake db:drop:all # Drops all the local databases defined in config/database.yml
  65. rake db:fixtures:identify # Search for a fixture given a LABEL or ID.
  66. rake db:fixtures:load # Load fixtures into the current environment's database.
  67. rake db:migrate # Migrate the database through scripts in db/migrate.
  68. rake db:migrate:down # Runs the "down" for a given migration VERSION.
  69. rake db:migrate:redo # Rollbacks the database one migration and re migrate up.
  70. rake db:migrate:reset # Resets your database using your migrations for the current environment
  71. rake db:migrate:up # Runs the "up" for a given migration VERSION.
  72. rake db:reset # Drops and recreates the database from db/schema.rb for the current environment.
  73. rake db:rollback # Rolls the schema back to the previous version.
  74. rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
  75. rake db:schema:load # Load a schema.rb file into the database
  76. rake db:sessions:clear # Clear the sessions table
  77. rake db:sessions:create # Creates a sessions migration for use with CGI::Session::ActiveRecordStore
  78. rake db:structure:dump # Dump the database structure to a SQL file
  79. rake db:test:clone # Recreate the test database from the current environment's database schema
  80. rake db:test:clone_structure # Recreate the test databases from the development structure
  81. rake db:test:load # Recreate the test database from the current schema.rb
  82. rake db:test:prepare # Check for pending migrations and load the test schema
  83. rake db:test:purge # Empty the test database
  84. rake db:version # Retrieves the current schema version number
  85. rake doc:app # Build the app HTML Files
  86. rake doc:clobber_app # Remove rdoc products
  87. rake doc:clobber_plugins # Remove plugin documentation
  88. rake doc:clobber_rails # Remove rdoc products
  89. rake doc:guides # Generate Rails guides
  90. rake doc:plugins # Generate documentation for all installed plugins
  91. rake doc:rails # Build the rails HTML Files
  92. rake doc:reapp # Force a rebuild of the RDOC files
  93. rake doc:rerails # Force a rebuild of the RDOC files
  94. rake gems # List the gems that this rails application depends on
  95. rake gems:build # Build any native extensions for unpacked gems
  96. rake gems:install # Installs all required gems for this application.
  97. rake gems:refresh_specs # Regenerate gem specifications in correct format.
  98. rake gems:unpack # Unpacks the specified gem into vendor/gems.
  99. rake gems:unpack:dependencies # Unpacks the specified gems and its dependencies into vendor/gems
  100. rake log:clear # Truncates all *.log files in log/ to zero bytes
  101. rake notes # Enumerate all annotations
  102. rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=WTFHAX
  103. rake notes:fixme # Enumerate all FIXME annotations
  104. rake notes:optimize # Enumerate all OPTIMIZE annotations
  105. rake notes:todo # Enumerate all TODO annotations
  106. rake rails:freeze:edge # Lock to latest Edge Rails, for a specific release use RELEASE=1.2.0
  107. rake rails:freeze:gems # Lock this application to the current gems (by unpacking them into vendor/rails)
  108. rake rails:unfreeze # Unlock this application from freeze of gems or edge and return to a fluid use of system gems
  109. rake rails:update # Update both configs, scripts and public/javascripts from Rails
  110. rake rails:update:configs # Update config/boot.rb from your current rails install
  111. rake rails:update:javascripts # Update your javascripts from your current rails install
  112. rake rails:update:scripts # Add new scripts to the application script/ directory
  113. rake routes # Print out all defined routes in match order, with names.
  114. rake secret # Generate a crytographically secure secret key.
  115. rake stats # Report code statistics (KLOCs, etc) from the application
  116. rake test # Run all unit, functional and integration tests
  117. rake test:benchmark # Run tests for benchmarkdb:test:prepare / Benchmark the performance tests
  118. rake test:functionals # Run tests for functionalsdb:test:prepare / Run the functional tests in test/functional
  119. rake test:integration # Run tests for integrationdb:test:prepare / Run the integration tests in test/integration
  120. rake test:plugins # Run tests for pluginsenvironment / Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)
  121. rake test:profile # Run tests for profiledb:test:prepare / Profile the performance tests
  122. rake test:recent # Run tests for recentdb:test:prepare / Test recent changes
  123. rake test:uncommitted # Run tests for uncommitteddb:test:prepare / Test changes since last checkin (only Subversion and Git)
  124. rake test:units # Run tests for unitsdb:test:prepare / Run the unit tests in test/unit
  125. rake time:zones:all # Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset.
  126. rake time:zones:local # Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time
  127. rake time:zones:us # Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset.
  128. rake tmp:cache:clear # Clears all files and directories in tmp/cache
  129. rake tmp:clear # Clear session, cache, and socket files from tmp/
  130. rake tmp:create # Creates tmp directories for sessions, cache, and sockets
  131. rake tmp:pids:clear # Clears all files in tmp/pids
  132. rake tmp:sessions:clear # Clears all files in tmp/sessions
  133. rake tmp:sockets:clear # Clears all files in tmp/sockets

migrate的更多相关文章

  1. PHP工作笔记:使用yii migrate管理、生成数据库

    第一步:进入yii migrate 通过dos(我是win7系统,其他系统类似,就是进入字符界面)打开网站目录 phpStudy/WWW/local/ddc_dlss 输入 ./yii migrate ...

  2. Migrate Instance 操作详解 - 每天5分钟玩转 OpenStack(40)

    Migrate 操作的作用是将 instance 从当前的计算节点迁移到其他节点上. Migrate 不要求源和目标节点必须共享存储,当然共享存储也是可以的. Migrate 前必须满足一个条件:计算 ...

  3. Live Migrate 操作 - 每天5分钟玩转 OpenStack(42)

    Migrate 操作会先将 instance 停掉,也就是所谓的“冷迁移”.而 Live Migrate 是“热迁移”,也叫“在线迁移”,instance不会停机. Live Migrate 分两种: ...

  4. South - 在 Django 中 Migrate Database

    Web 开发避免不了经常修改表结构,手工修改表结构不仅容易出错,而且涉及到多人协作开发时,这么土的做法很不经济. Django 的第三方 app South 就是专门做数据库表结构自动迁移的.Jaco ...

  5. 使用migrate.exe执行EF code first 迁移

    Code First 迁移可用于从 Visual Studio 内部更新数据库,但也可通过命令行工具 migrate.exe 来执行.本页简单介绍如何使用 migrate.exe 对数据库执行迁移. ...

  6. How to migrate from VMware and Hyper-V to OpenStack

    Introduction I migrated >120 VMware virtual machines (Linux and Windows) from VMware ESXi to Open ...

  7. mybatis migrate常用指令

    0.制定db和配置文件 --path=xxx --env=dev 1.初始化Migrations工作目录 migrate init 2.创建数据库变更 migrate new "liyq a ...

  8. South——谁说Django不能migrate!

    零.前言 最近改一个项目,需要对已有的model进行更改.大家都知道Django自带的syncdb只能创建数据库,但是无法将已经改变的model应用的数据库中. 大概两年前遇到这个问题的时候,网上的答 ...

  9. 当用DJANGO的migrate不成功时。。。。

    URL:http://my.oschina.net/u/862582/blog/355421 因为操作SQL数据库时不规范,或是多人开发时产生了同步问题,就可能导致正规的MIGRATE时不能完成. 已 ...

  10. Yii2的相关学习记录,前后台分离及migrate使用(七)

    最近一直忙其它的(其实是懒!),将<深入理解Yii2>看了一遍,一些当初没明白的稍微明了了点,然后又看yii2的图片上传等处理.富文本.restful什么的,但由于没进行到这里,只看也不管 ...

随机推荐

  1. 【BIEE】05_启动BIEE时,无法启动BI_SERVER

    本地修改资料库后,重新启动BIEE,结果报错: 点击[查看日志信息]后 从这里是没看出是什么问题造成的,那么我们就要去查询启动日志了 问题解决 找到日志路径:D:\obiee\instances\in ...

  2. SearchView的全面解析

    代码地址如下:http://www.demodashi.com/demo/12535.html 前言 今天来讲讲searchView的使用,这里讲的searchView是引用android.suppo ...

  3. win7不休眠方式设置

    方式1:命令行下以管理员方式执行:powercfg -h off 方式2:右键个性化-->屏幕保护程序-->更改电源设置--->更改计算机睡眠时间--->是计算机进入睡眠状态选 ...

  4. 优化MyDb

    import pymysqlclass MyDb(object): #新式类 def __del__(self):#析构函数 self.cur.close() self.coon.close() pr ...

  5. view无限旋转

    - (void) showRefreshAnimation { [UIView animateWithDuration: options:UIViewAnimationOptionCurveLinea ...

  6. 前台freemark获取后台的值

    1.后台代码: ModelAndView mv = new ModelAndView("log/logList.ftl"); String info="abc" ...

  7. linux上复制行到另一个文件

    1.复制3行到5行数据到ab.sh文件,不覆盖ab.sh文件中的已有内容 :3,5w>>ab.sh 2.复制3行到5行数据到ab.sh文件,覆盖ab.sh文件中的已有内容 :3,5w!ab ...

  8. CardView的具体使用方法(转)

    转载自:CardView的具体使用方法  因为学习做此记录方便查找使用 今天主要是CardView的用法,CardView是在安卓5.0提出的卡片式控件.首先介绍一下它的配置. 在gradle文件下添 ...

  9. 多媒体开发之rtp 打包发流---udp 丢包问题

    http://blog.csdn.net/acs713/article/details/19339707

  10. HDU 3397 Sequence operation(区间合并 + 区间更新)

    题目链接:pid=3397">http://acm.hdu.edu.cn/showproblem.php?pid=3397 题意:给定n个数,由0,1构成.共同拥有5种操作. 每一个操 ...