diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index ad698f1..5601a7b 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -10,7 +10,7 @@ def admin_index authorize Template #institutional templates - all_versions_own_templates = Template.where(org_id: current_user.org_id, customization_of: nil).order(:version) + all_versions_own_templates = Template.where(org_id: current_user.org_id, customization_of: nil).order(version: :desc) current_templates = {} all_versions_own_templates.each do |temp| if current_templates[temp.dmptemplate_id].nil? @@ -50,12 +50,14 @@ # POST /dmptemplates + # creates a new template with version 0 and new dmptemplate_id def admin_create @template = Template.new(params[:template]) @template.org_id = current_user.org_id @template.description = params['template-desc'] @template.published = false @template.version = 0 + # Generate a unique identifier for the dmptemplate_id @template.dmptemplate_id = loop do random = rand 2147483647 break random unless Template.exists?(dmptemplate_id: random) @@ -77,6 +79,13 @@ redirect_to admin_index_template_path end + # GET /templates/1 + def admin_template_history + @template = Template.find(params[:id]) + authorize @template + @templates = Template.where(dmptemplate_id: @template.dmptemplate_id).order(:version) + end + # PHASES diff --git a/app/policies/template_policy.rb b/app/policies/template_policy.rb index 3524c40..1fd64f5 100644 --- a/app/policies/template_policy.rb +++ b/app/policies/template_policy.rb @@ -31,6 +31,10 @@ user.can_modify_templates? && (template.org_id == user.org_id) end + def admin_template_history? + user.can_modify_templates? && (template.org_id == user.org_id) + end + def admin_phase? user.can_modify_templates? && (template.org_id == user.org_id) end diff --git a/app/views/templates/admin_index.html.erb b/app/views/templates/admin_index.html.erb index 89ef362..4051b7d 100644 --- a/app/views/templates/admin_index.html.erb +++ b/app/views/templates/admin_index.html.erb @@ -1,72 +1,69 @@ <%= stylesheet_link_tag "admin" %>

- <%= t('org_admin.templates_label') %> + <%= t('org_admin.templates_label') %>

- <%= t('org_admin.templates.own_temp') %> + <%= t('org_admin.templates.own_temp') %>

- <%= raw t('org_admin.templates.create_own_template_text_html')%> + <%= raw t('org_admin.templates.create_own_template_text_html')%>
- -
- <%= link_to t("org_admin.templates.create_template"), - admin_new_template_path, - class: 'btn btn-primary' %> -
+ +
+ <%= link_to t("org_admin.templates.create_template"), + admin_new_template_path, + class: 'btn btn-primary' %> +
<% if @templates_own.length > 0 then %> - - - - - - - - - - - - <% @templates_own.each do |org_template| %> +
<%= t('org_admin.templates.title_label') %><%= t('org_admin.templates.desc_label') %><%= t('org_admin.templates.published_label') %><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
+ + + + + + + + + + + <% @templates_own.each do |org_template| %> - - - - - + + + + - - - <%end%> - -
<%= t('org_admin.templates.title_label') %><%= t('org_admin.templates.desc_label') %><%= t('org_admin.templates.published_label') %><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
- <%= org_template.title%> - - <%= raw org_template.description.truncate(90, omission: t('helpers.truncate_continued')) %> - - <%= org_template.published %> - - <% last_temp_updated = org_template.updated_at %> +
+ <%= org_template.title%> + + <%= raw org_template.description.truncate(90, omission: t('helpers.truncate_continued')) %> + + <%= org_template.published %> + + <% last_temp_updated = org_template.updated_at %> <% org_template.phases.each do |phase|%> <% if org_template.updated_at.to_date < phase.updated_at.to_date then %> <% last_temp_updated = phase.updated_at %> <% end %> <% end %> <%= l last_temp_updated.to_date, formats: :short %> - - <%if current_user.can_org_admin? then%> - <% b_label = t('helpers.submit.edit')%> - <%else%> - <% b_label = t('helpers.view')%> - <%end%> - <%= link_to b_label, admin_template_template_path(org_template), class: "dmp_table_link"%> -
+ + + <%= link_to t('helpers.submit.edit'), admin_template_template_path(id: org_template.id, edit: "true"), class: "dmp_table_link" %> + <%= link_to t('helpers.view'), admin_template_template_path(id: org_template), class: "dmp_table_link"%> + <%= link_to t('helpers.history'), admin_template_history_template_path(id: org_template.id), class: "dmp_table_link" %> + + + <%end%> + + <%end%> @@ -136,5 +133,5 @@ <%end%> - <%end%> + <%end%> <%end%> diff --git a/app/views/templates/admin_template_history.html.erb b/app/views/templates/admin_template_history.html.erb new file mode 100644 index 0000000..c451c8d --- /dev/null +++ b/app/views/templates/admin_template_history.html.erb @@ -0,0 +1,63 @@ +<%= stylesheet_link_tag "admin" %> + +

+ <%= @template.title %> +

+
+

+ <%= t('org_admin.templates.template_history') %> +

+ +
+ <%= raw t('org_admin.templates.template_history_text_html')%> +
+
+ <%= link_to t("org_admin.templates.view_all_templates"), + admin_index_template_path, + class: 'btn btn-primary' %> +
+ +
+ + +<% if @templates.length > 0 then %> + + + + + + + + + + + + <% @templates.each do |org_template| %> + + + + + + + + <%end%> + +
<%= t('org_admin.templates.title_label') %><%= "Version" %><%= t('org_admin.templates.published_label') %><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
+ <%= org_template.title%> + + <%= org_template.version %> + + <%= org_template.published %> + + <% last_temp_updated = org_template.updated_at %> + <% org_template.phases.each do |phase|%> + <% if org_template.updated_at.to_date < phase.updated_at.to_date %> + <% last_temp_updated = phase.updated_at %> + <% end %> + <% end %> + <%= l last_temp_updated.to_date, formats: :short %> + + <%= link_to t('helpers.view'), admin_template_template_path(id: org_template), class: "dmp_table_link"%> +
+ +<%end%> \ No newline at end of file diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml index 33f4b85..ad38736 100644 --- a/config/locales/en-UK.yml +++ b/config/locales/en-UK.yml @@ -232,6 +232,7 @@ updated_message: "Guidance group was successfully updated." destroyed_message: "Guidance group was successfully deleted." templates: + template_history: "Template History" create_template: "Create a template" new_label: "New template" template_details: "Template details" @@ -244,6 +245,7 @@ create_own_template_text_html: "

If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

" create_new_template_text_html: "

To create a new template, first enter a title and description. Once you have saved this you will be presented with options to add one or more phases.

" + template_history_text_html: "

Here you can view previously published versions of your template. These are read only and cannot be modified.

" desc_help_text_html: "Enter a description that helps you to differentiate between templates e.g. if you have ones for different audiences" own_temp: "Own templates" add_phase_label: "Add new phase +" @@ -429,6 +431,7 @@ note: "Note" me: "Me" view: "View" + history: "History" desc: "Description" save: "Save" preview: "Preview" diff --git a/config/routes.rb b/config/routes.rb index 8c35cc8..fd636fc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -101,6 +101,7 @@ get 'admin_phase' get 'admin_previewphase' get 'admin_cloneversion' + get 'admin_template_history' delete 'admin_destroy' delete 'admin_destroyversion' delete 'admin_destroyphase' diff --git a/db/schema.rb b/db/schema.rb index b749bfe..87b1514 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,59 +13,58 @@ ActiveRecord::Schema.define(version: 20170130173612) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + create_table "answers", force: :cascade do |t| - t.text "text", limit: 65535 - t.integer "plan_id", limit: 4 - t.integer "user_id", limit: 4 - t.integer "question_id", limit: 4 + t.text "text" + t.integer "plan_id" + t.integer "user_id" + t.integer "question_id" t.datetime "created_at" t.datetime "updated_at" end - add_index "answers", ["plan_id"], name: "fk_rails_84a6005a3e", using: :btree - add_index "answers", ["question_id"], name: "fk_rails_3d5ed4418f", using: :btree - add_index "answers", ["user_id"], name: "fk_rails_584be190c2", using: :btree - create_table "answers_question_options", id: false, force: :cascade do |t| - t.integer "answer_id", limit: 4, null: false - t.integer "question_option_id", limit: 4, null: false + t.integer "answer_id", null: false + t.integer "question_option_id", null: false end add_index "answers_question_options", ["answer_id", "question_option_id"], name: "answer_question_option_index", using: :btree add_index "answers_question_options", ["question_option_id", "answer_id"], name: "question_option_answer_index", using: :btree create_table "exported_plans", force: :cascade do |t| - t.integer "plan_id", limit: 4 - t.integer "user_id", limit: 4 - t.string "format", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.integer "plan_id" + t.integer "user_id" + t.string "format" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "file_types", force: :cascade do |t| - t.string "name", limit: 255 - t.string "icon_name", limit: 255 - t.integer "icon_size", limit: 4 - t.string "icon_location", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.string "name" + t.string "icon_name" + t.integer "icon_size" + t.string "icon_location" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "file_uploads", force: :cascade do |t| - t.string "name", limit: 255 - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "size", limit: 4 + t.string "name" + t.string "title" + t.text "description" + t.integer "size" t.boolean "published" - t.string "location", limit: 255 - t.integer "file_type_id", limit: 4 - t.datetime "created_at" - t.datetime "updated_at" + t.string "location" + t.integer "file_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", limit: 255, null: false - t.integer "sluggable_id", limit: 4, null: false + t.string "slug", null: false + t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 40 t.datetime "created_at" end @@ -75,333 +74,293 @@ add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree create_table "guidance_groups", force: :cascade do |t| - t.string "name", limit: 255 - t.integer "org_id", limit: 4 - t.datetime "created_at" - t.datetime "updated_at" + t.string "name" + t.integer "org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.boolean "optional_subset" t.boolean "published" end - add_index "guidance_groups", ["org_id"], name: "fk_rails_819c1dbbc7", using: :btree - create_table "guidances", force: :cascade do |t| - t.text "text", limit: 65535 - t.integer "guidance_group_id", limit: 4 - t.datetime "created_at" - t.datetime "updated_at" - t.integer "question_id", limit: 4 + t.text "text" + t.integer "guidance_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "question_id" t.boolean "published" end - add_index "guidances", ["guidance_group_id"], name: "fk_rails_20d29da787", using: :btree - create_table "identifier_schemes", force: :cascade do |t| - t.string "name", limit: 255 - t.string "description", limit: 255 + t.string "name" + t.string "description" t.boolean "active" t.datetime "created_at" t.datetime "updated_at" end create_table "languages", force: :cascade do |t| - t.string "abbreviation", limit: 255 - t.string "description", limit: 255 - t.string "name", limit: 255 + t.string "abbreviation" + t.string "description" + t.string "name" t.boolean "default_language" end create_table "notes", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.text "text", limit: 65535 + t.integer "user_id" + t.text "text" t.boolean "archived" - t.integer "answer_id", limit: 4 - t.integer "archived_by", limit: 4 + t.integer "answer_id" + t.integer "archived_by" t.datetime "created_at" t.datetime "updated_at" end - add_index "notes", ["answer_id"], name: "fk_rails_907f8d48bf", using: :btree - add_index "notes", ["user_id"], name: "fk_rails_7f2323ad43", using: :btree - create_table "org_token_permissions", force: :cascade do |t| - t.integer "org_id", limit: 4 - t.integer "token_permission_type_id", limit: 4 + t.integer "org_id" + t.integer "token_permission_type_id" t.datetime "created_at" t.datetime "updated_at" end - add_index "org_token_permissions", ["org_id"], name: "fk_rails_e1db1b22c5", using: :btree - add_index "org_token_permissions", ["token_permission_type_id"], name: "fk_rails_2aa265f538", using: :btree - create_table "orgs", force: :cascade do |t| - t.string "name", limit: 255 - t.string "abbreviation", limit: 255 - t.string "target_url", limit: 255 - t.string "wayfless_entity", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.integer "parent_id", limit: 4 + t.string "name" + t.string "abbreviation" + t.string "target_url" + t.string "wayfless_entity" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "parent_id" t.boolean "is_other" - t.string "sort_name", limit: 255 - t.text "banner_text", limit: 65535 - t.string "logo_file_name", limit: 255 - t.integer "region_id", limit: 4 - t.integer "language_id", limit: 4 - t.string "logo_uid", limit: 255 - t.string "logo_name", limit: 255 - t.string "contact_email", limit: 255 - t.integer "org_type", limit: 4, default: 0, null: false + t.string "sort_name" + t.text "banner_text" + t.string "logo_file_name" + t.integer "region_id" + t.integer "language_id" + t.string "logo_uid" + t.string "logo_name" + t.string "contact_email" + t.integer "org_type", default: 0, null: false end - add_index "orgs", ["language_id"], name: "fk_rails_5640112cab", using: :btree - add_index "orgs", ["region_id"], name: "fk_rails_5a6adf6bab", using: :btree - create_table "perms", force: :cascade do |t| - t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "perms", ["name"], name: "index_perms_on_name", using: :btree add_index "perms", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree create_table "phases", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "number", limit: 4 - t.integer "template_id", limit: 4 + t.string "title" + t.text "description" + t.integer "number" + t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255 + t.string "slug" t.boolean "modifiable" end - add_index "phases", ["template_id"], name: "fk_rails_0f8036cb2e", using: :btree - create_table "plans", force: :cascade do |t| - t.integer "project_id", limit: 4 - t.string "title", limit: 255 - t.integer "template_id", limit: 4 + t.integer "project_id" + t.string "title" + t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255 - t.string "grant_number", limit: 255 - t.string "identifier", limit: 255 - t.text "description", limit: 65535 - t.string "principal_investigator", limit: 255 - t.string "principal_investigator_identifier", limit: 255 - t.string "data_contact", limit: 255 - t.string "funder_name", limit: 255 - t.integer "visibility", limit: 4, default: 0, null: false + t.string "slug" + t.string "grant_number" + t.string "identifier" + t.text "description" + t.string "principal_investigator" + t.string "principal_investigator_identifier" + t.string "data_contact" + t.string "funder_name" + t.integer "visibility", default: 0, null: false end - add_index "plans", ["template_id"], name: "fk_rails_3424ca281f", using: :btree - create_table "question_formats", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "option_based", default: false + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "option_based", default: false end create_table "question_options", force: :cascade do |t| - t.integer "question_id", limit: 4 - t.string "text", limit: 255 - t.integer "number", limit: 4 + t.integer "question_id" + t.string "text" + t.integer "number" t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" end - add_index "question_options", ["question_id"], name: "fk_rails_b9c5f61cf9", using: :btree - create_table "questions", force: :cascade do |t| - t.text "text", limit: 65535 - t.text "default_value", limit: 65535 - t.text "guidance", limit: 65535 - t.integer "number", limit: 4 - t.integer "section_id", limit: 4 + t.text "text" + t.text "default_value" + t.text "guidance" + t.integer "number" + t.integer "section_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "question_format_id", limit: 4 - t.boolean "option_comment_display", default: true + t.integer "question_format_id" + t.boolean "option_comment_display", default: true t.boolean "modifiable" end - add_index "questions", ["question_format_id"], name: "fk_rails_4fbc38c8c7", using: :btree - add_index "questions", ["section_id"], name: "fk_rails_c50eadc3e3", using: :btree - create_table "questions_themes", id: false, force: :cascade do |t| - t.integer "question_id", limit: 4, null: false - t.integer "theme_id", limit: 4, null: false + t.integer "question_id", null: false + t.integer "theme_id", null: false end add_index "questions_themes", ["question_id", "theme_id"], name: "question_theme_index", using: :btree add_index "questions_themes", ["theme_id", "question_id"], name: "theme_question_index", using: :btree create_table "region_groups", force: :cascade do |t| - t.integer "super_region_id", limit: 4 - t.integer "region_id", limit: 4 + t.integer "super_region_id" + t.integer "region_id" end create_table "regions", force: :cascade do |t| - t.string "abbreviation", limit: 255 - t.string "description", limit: 255 - t.string "name", limit: 255 + t.string "abbreviation" + t.string "description" + t.string "name" end create_table "roles", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "plan_id", limit: 4 + t.integer "user_id" + t.integer "plan_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "access", limit: 4, default: 0, null: false + t.integer "access", default: 0, null: false end - add_index "roles", ["plan_id"], name: "fk_rails_a1ce6c2772", using: :btree - add_index "roles", ["user_id"], name: "fk_rails_ab35d699f0", using: :btree - create_table "sections", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "number", limit: 4 + t.string "title" + t.text "description" + t.integer "number" t.datetime "created_at" t.datetime "updated_at" t.boolean "published" - t.integer "phase_id", limit: 4 + t.integer "phase_id" t.boolean "modifiable" end - add_index "sections", ["phase_id"], name: "fk_rails_1853581585", using: :btree - create_table "settings", force: :cascade do |t| - t.string "var", limit: 255, null: false - t.text "value", limit: 65535 - t.integer "target_id", limit: 4, null: false - t.string "target_type", limit: 255, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.string "var", null: false + t.text "value" + t.integer "target_id", null: false + t.string "target_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree create_table "splash_logs", force: :cascade do |t| - t.string "destination", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.string "destination" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "suggested_answers", force: :cascade do |t| - t.integer "question_id", limit: 4 - t.integer "org_id", limit: 4 - t.text "text", limit: 65535 + t.integer "question_id" + t.integer "org_id" + t.text "text" t.boolean "is_example" t.datetime "created_at" t.datetime "updated_at" end - add_index "suggested_answers", ["org_id"], name: "fk_rails_473de65779", using: :btree - add_index "suggested_answers", ["question_id"], name: "fk_rails_daa60b5b70", using: :btree - create_table "templates", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 + t.string "title" + t.text "description" t.boolean "published" - t.integer "org_id", limit: 4 - t.string "locale", limit: 255 + t.integer "org_id" + t.string "locale" t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" - t.integer "version", limit: 4 - t.integer "visibility", limit: 4 - t.integer "customization_of", limit: 4 - t.integer "dmptemplate_id", limit: 4 + t.integer "version" + t.integer "visibility" + t.integer "customization_of" + t.integer "dmptemplate_id" end - add_index "templates", ["org_id"], name: "fk_rails_481431e1bd", using: :btree - create_table "themes", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.datetime "created_at" - t.datetime "updated_at" - t.string "locale", limit: 255 + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale" end create_table "themes_in_guidance", id: false, force: :cascade do |t| - t.integer "theme_id", limit: 4 - t.integer "guidance_id", limit: 4 + t.integer "theme_id" + t.integer "guidance_id" end - add_index "themes_in_guidance", ["guidance_id"], name: "fk_rails_a5ab9402df", using: :btree - add_index "themes_in_guidance", ["theme_id"], name: "fk_rails_7d708f6f1e", using: :btree - create_table "token_permission_types", force: :cascade do |t| - t.string "token_type", limit: 255 - t.text "text_description", limit: 65535 + t.string "token_type" + t.text "text_description" t.datetime "created_at" t.datetime "updated_at" end create_table "user_identifiers", force: :cascade do |t| - t.string "identifier", limit: 255 + t.string "identifier" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id", limit: 4 - t.integer "identifier_scheme_id", limit: 4 + t.integer "user_id" + t.integer "identifier_scheme_id" end - add_index "user_identifiers", ["identifier_scheme_id"], name: "fk_rails_fe95df7db0", using: :btree - add_index "user_identifiers", ["user_id"], name: "fk_rails_65c9a98cdb", using: :btree - create_table "users", force: :cascade do |t| - t.string "firstname", limit: 255 - t.string "surname", limit: 255 - t.string "email", limit: 255, default: "", null: false - t.string "shibboleth_id", limit: 255 + t.string "firstname" + t.string "surname" + t.string "email", default: "", null: false + t.string "orcid_id" + t.string "shibboleth_id" t.datetime "created_at" t.datetime "updated_at" - t.string "encrypted_password", limit: 255, default: "" - t.string "reset_password_token", limit: 255 + t.string "encrypted_password", default: "" + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0 + t.integer "sign_in_count", default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "invitation_token", limit: 255 + t.string "invitation_token" t.datetime "invitation_created_at" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" - t.string "other_organisation", limit: 255 + t.string "other_organisation" t.boolean "dmponline3" t.boolean "accept_terms" - t.integer "org_id", limit: 4 - t.string "api_token", limit: 255 - t.integer "invited_by_id", limit: 4 - t.string "invited_by_type", limit: 255 - t.integer "language_id", limit: 4 + t.integer "org_id" + t.string "api_token" + t.integer "invited_by_id" + t.string "invited_by_type" + t.integer "language_id" end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true, using: :btree - add_index "users", ["language_id"], name: "fk_rails_45f4f12508", using: :btree - add_index "users", ["org_id"], name: "fk_rails_e73753bccb", using: :btree add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree create_table "users_perms", id: false, force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "perm_id", limit: 4 + t.integer "user_id" + t.integer "perm_id" end - add_index "users_perms", ["perm_id"], name: "fk_rails_457217c31c", using: :btree add_index "users_perms", ["user_id", "perm_id"], name: "index_users_perms_on_user_id_and_perm_id", using: :btree add_foreign_key "answers", "plans"