| @@ -2,12 +2,14 @@ class CreateClas < ActiveRecord::Migration[5.2] | |||||
| def change | def change | ||||
| create_table :clas do |t| | create_table :clas do |t| | ||||
| t.string :name, null:false | t.string :name, null:false | ||||
| t.string :key, index:true, null:false | |||||
| t.string :key, null:false | |||||
| t.text :content | t.text :content | ||||
| t.integer :organization_id, index:true, null:false | |||||
| t.integer :organization_id, null:false | |||||
| t.boolean :pr_need, default: false | t.boolean :pr_need, default: false | ||||
| t.integer :count, default: 0 | t.integer :count, default: 0 | ||||
| t.timestamps | t.timestamps | ||||
| end | end | ||||
| add_index :clas, :key, :length =>190 | |||||
| add_index :clas, :organization_id | |||||
| end | end | ||||
| end | end | ||||
| @@ -1,12 +1,15 @@ | |||||
| class CreateUserClas < ActiveRecord::Migration[5.2] | class CreateUserClas < ActiveRecord::Migration[5.2] | ||||
| def change | def change | ||||
| create_table :user_clas do |t| | create_table :user_clas do |t| | ||||
| t.integer :user_id, null:false, index: true | |||||
| t.integer :cla_id, null:false, index: true | |||||
| t.integer :user_id, null:false | |||||
| t.integer :cla_id, null:false | |||||
| t.string :real_name, null:false | t.string :real_name, null:false | ||||
| t.string :email, null:false | t.string :email, null:false | ||||
| t.integer :state, default:0 | t.integer :state, default:0 | ||||
| t.timestamps | t.timestamps | ||||
| end | end | ||||
| add_index :user_clas, :user_id | |||||
| add_index :user_clas, :cla_id | |||||
| end | end | ||||
| end | end | ||||