ruby on rails, api only, 脚手架
阅读原文时间:2023年07月12日阅读:2

rails new connector_api --api --database=postgresql

bundle install

rake db:create

rails g scaffold issues jira_key:string project_name:string backend:string summary:string description:text trello_card_id:string

rake db:migrate

------------------------------------------------------------------------------------------------------------------------

roll back:

rake db:rollback

rails d scaffold cards

------------------------------------------------------------------------------------------------------------------------

Postgresql

brew services start postgresql

------------------------------------------------------------------------------------------------------------------------

generate a model

bin/rails generate model checklist trello_issue_id:string toggleUser:string toggleDate:timestamp

------------------------------------------------------------------------------------------------------------------------

绑定localhost -- 搭配ngrok

rails s -b localhost

------------------------------------------------------------------------------------------------------------------------

生产环境

rails server -e production

------------------------------------------------------------------------------------------------------------------------

rename_table
rails g migration ChangeColumnInjlists

rename_table :old_table_name, :new_table_name

------------------------------------------------------------------------------------------------------------------------

rails destroy model labels

------------------------------------------------------------------------------------------------------------------------

Create a controller

bin/rails generate controller Git

------------------------------------------------------------------------------------------------------------------------

url: https://stackoverflow.com/questions/1992019/how-can-i-rename-a-database-column-in-a-ruby-on-rails-migration

Delete attribute form model in Ruby on Rail

rails g migration migrationname

remove_column :users, :age

Rails 5: rename table migration

rails g migration change_[old_table_name]_to_[new_table_name]

def change

rename_table :[old_table_name], :[new_table_name]

rename_column :table_name, :old_column, :new_column

end

Rails: add index

add_index :table_name, :column_name, unique: true

Rails: add column table migration

add_column :posts, views, :integer

从staging上pull数据bundle exec cap staging db:pull

open coverage/index.html