ActiveRecord: List columns in table from console

前端 未结 8 1370
遥遥无期
遥遥无期 2020-12-22 23:21

I know that you can ask ActiveRecord to list tables in console using:

ActiveRecord::Base.connection.tables

Is there a command that would li

8条回答
  •  长情又很酷
    2020-12-22 23:43

    You can run rails dbconsole in you command line tool to open sqlite console. Then type in .tables to list all the tables and .fullschema to get a list of all tables with column names and types.

提交回复
热议问题