自动生成的id 被当作primary key来使用

timestamp method生成 created_at 与 updated_at columns

create_table 和 drop_table 用来生成表与删除表

null:false 表明不能为null

rake db:rollback  ---- 返回到上次migration之前的状态

添加与删除列:

add_column :table_name, :column_name, :column_type

remove_column :table_name, :column_name

rake:schema:load 读取schema

重命名column:

rename_column :table_name, :old_column_name, :new_column_name

或者 rails g migration rename_make_to_company  =>   rename_column :cars, :make, :company

RoR - Creating and Modifying Table and Columns的更多相关文章

  1. 【C#】Creating/Querying/Modifying the .mdb databases

    As for databases, there are quit many kinds such as foxpro, mysql, sqlserver, etc. But when we need ...

  2. mysqladmin processlist; show processlist/status/open tables/engine/variables/table status/columns/grants/index/privileges/innodb status/logs/warnings/////; 结果筛选

    mysqladmin showprocesslist可查看完整sql需要权限. SHOW PROCESSLIST显示哪些线程正在运行.您也可以使用mysqladmin processlist语句得到此 ...

  3. Creating a settings table that can handle almost any type of value

    Update: Updated article here. Today I wanted to be able to have a table store any type of value as a ...

  4. Spark 2.x不支持ALTER TABLE ADD COLUMNS,没关系,我们改进下

    SparkSQL从2.0开始已经不再支持ALTER TABLE table_name ADD COLUMNS (col_name data_type [COMMENT col_comment], .. ...

  5. 自己动手为Spark 2.x添加ALTER TABLE ADD COLUMNS语法支持

    SparkSQL从2.0开始已经不再支持ALTER TABLE table_name ADD COLUMNS (col_name data_type [COMMENT col_comment], .. ...

  6. Table View Programming Guide for iOS---(五)---Creating and Configuring a Table View

    Creating and Configuring a Table View Your app must present a table view to users before it can mana ...

  7. MySQL 5.6 Reference Manual-14.7 InnoDB Table Compression

    14.7 InnoDB Table Compression 14.7.1 Overview of Table Compression 14.7.2 Enabling Compression for a ...

  8. [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table

    Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...

  9. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

随机推荐

  1. 关于 Docker Hub 上不能注册 Docker ID 的问题

    1. 引言 我们中国大陆访问dockerhub的时候,想要注册一个dockerID,发现sign up按钮是灰色的,不能点击进行注册.这个时候通过点击右键"查看网页源代码"和&qu ...

  2. YARN Resource Management

    https://www.jianshu.com/p/b9245242472b https://stackoverflow.com/questions/42637631/what-does-virtua ...

  3. Redis 的事务到底是不是原子性的

    ACID 中关于原子性的定义: 原子性:一个事务(transaction)中的所有操作,要么全部完成,要么全部不完成,不会结束在中间某个环节.事务在执行过程中发生错误,会被恢复(Rollback)到事 ...

  4. Hadoop:hdfs文件permission denied问题解析

    Cron jobs can be scheduled, but fail to write parquet file and seems due to user permission of “yarn ...

  5. [微信小程序] 微信小程序开发初步探索

    1.开发文档 https://developers.weixin.qq.com/miniprogram/dev/ app.json配置:https://developers.weixin.qq.com ...

  6. Attacks for RL

    1. http://rll.berkeley.edu/adversarial/   Adversarial Attacks on Neural Network Policies 就是对test时候的p ...

  7. 消息中间件系列四:RabbitMQ与Spring集成

    一.RabbitMQ与Spring集成  准备工作: 分别新建名为RabbitMQSpringProducer和RabbitMQSpringConsumer的maven web工程 在pom.xml文 ...

  8. myeclipse及Eclipse中.classpath、.project、.settings、.mymetadata(myeclipse特有)介绍

    引言 今天在创建java项目的时候遇到了很多的错误,在解决的过程中遇到了一些根本不知道什么作用的文件,然后按照网上的一些做法可以将问题解决,但是这也说明我们在学习的时候很多基础和细节的地方是我们薄弱的 ...

  9. NuGet Packages are missing,This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.

    错误内容 This project references NuGet package(s) that are missing on this computer. Use NuGet Package R ...

  10. Debian/Ubuntu pip default install to $HOME/.local

    pip default install to $HOME/.local on Debian/Ubuntu After pip 8.1.1-2 on Debian or Ubuntu you can p ...