bullet_train 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/bullet_train_manifest.js +0 -0
  6. data/app/controllers/account/invitations_controller.rb +146 -0
  7. data/app/controllers/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments_controller.rb +83 -0
  8. data/app/controllers/account/memberships_controller.rb +132 -0
  9. data/app/controllers/account/onboarding/user_details_controller.rb +63 -0
  10. data/app/controllers/account/onboarding/user_email_controller.rb +65 -0
  11. data/app/controllers/account/teams_controller.rb +122 -0
  12. data/app/controllers/account/users_controller.rb +59 -0
  13. data/app/helpers/account/invitations_helper.rb +2 -0
  14. data/app/helpers/account/memberships_helper.rb +9 -0
  15. data/app/helpers/account/teams_helper.rb +80 -0
  16. data/app/helpers/account/users_helper.rb +81 -0
  17. data/app/helpers/invitation_only_helper.rb +10 -0
  18. data/app/helpers/invitations_helper.rb +17 -0
  19. data/app/models/invitation.rb +73 -0
  20. data/app/models/membership.rb +164 -0
  21. data/app/models/memberships/reassignments/assignment.rb +12 -0
  22. data/app/models/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignment.rb +38 -0
  23. data/app/models/memberships/reassignments.rb +5 -0
  24. data/app/models/team.rb +81 -0
  25. data/app/models/user.rb +191 -0
  26. data/app/views/account/invitations/_breadcrumbs.html.erb +9 -0
  27. data/app/views/account/invitations/_form.html.erb +49 -0
  28. data/app/views/account/invitations/_invitation.json.jbuilder +7 -0
  29. data/app/views/account/invitations/index.json.jbuilder +1 -0
  30. data/app/views/account/invitations/new.html.erb +12 -0
  31. data/app/views/account/invitations/show.html.erb +30 -0
  32. data/app/views/account/invitations/show.json.jbuilder +1 -0
  33. data/app/views/account/memberships/_breadcrumbs.html.erb +8 -0
  34. data/app/views/account/memberships/_form.html.erb +45 -0
  35. data/app/views/account/memberships/_index.html.erb +66 -0
  36. data/app/views/account/memberships/_menu_item.html.erb +8 -0
  37. data/app/views/account/memberships/_tombstones.html.erb +59 -0
  38. data/app/views/account/memberships/edit.html.erb +22 -0
  39. data/app/views/account/memberships/index.html.erb +7 -0
  40. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/_breadcrumbs.html.erb +10 -0
  41. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/_form.html.erb +24 -0
  42. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/_scaffolding_completely_concrete_tangible_things_reassignment.json.jbuilder +8 -0
  43. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/index.json.jbuilder +1 -0
  44. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/new.html.erb +11 -0
  45. data/app/views/account/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments/show.json.jbuilder +1 -0
  46. data/app/views/account/memberships/show.html.erb +60 -0
  47. data/app/views/account/onboarding/user_details/edit.html.erb +72 -0
  48. data/app/views/account/onboarding/user_email/edit.html.erb +33 -0
  49. data/app/views/account/teams/_breadcrumbs.html.erb +11 -0
  50. data/app/views/account/teams/_form.html.erb +22 -0
  51. data/app/views/account/teams/_index.html.erb +33 -0
  52. data/app/views/account/teams/_menu_item.html.erb +8 -0
  53. data/app/views/account/teams/_team.json.jbuilder +9 -0
  54. data/app/views/account/teams/edit.html.erb +12 -0
  55. data/app/views/account/teams/index.html.erb +6 -0
  56. data/app/views/account/teams/index.json.jbuilder +1 -0
  57. data/app/views/account/teams/new.html.erb +88 -0
  58. data/app/views/account/teams/show.html.erb +25 -0
  59. data/app/views/account/teams/show.json.jbuilder +1 -0
  60. data/app/views/account/users/_breadcrumbs.html.erb +4 -0
  61. data/app/views/account/users/_form.html.erb +39 -0
  62. data/app/views/account/users/edit.html.erb +50 -0
  63. data/app/views/account/users/show.html.erb +17 -0
  64. data/config/locales/en/invitations.en.yml +69 -0
  65. data/config/locales/en/memberships/reassignments/scaffolding_completely_concrete_tangible_things_reassignments.en.yml +42 -0
  66. data/config/locales/en/memberships.en.yml +99 -0
  67. data/config/locales/en/onboarding/user_details.en.yml +11 -0
  68. data/config/locales/en/onboarding/user_email.en.yml +13 -0
  69. data/config/locales/en/teams.en.yml +85 -0
  70. data/config/locales/en/users.en.yml +110 -0
  71. data/config/routes.rb +2 -0
  72. data/db/migrate/20161115160419_devise_create_users.rb +41 -0
  73. data/db/migrate/20161116003852_add_api_key_to_user.rb +6 -0
  74. data/db/migrate/20161117154605_create_teams.rb +10 -0
  75. data/db/migrate/20161117154709_create_memberships.rb +11 -0
  76. data/db/migrate/20161203193930_add_current_team_to_user.rb +5 -0
  77. data/db/migrate/20161204234150_create_invitations.rb +11 -0
  78. data/db/migrate/20161205154821_add_team_to_invitation.rb +5 -0
  79. data/db/migrate/20161205164613_add_admin_to_invitation.rb +5 -0
  80. data/db/migrate/20170908205756_add_names_to_user.rb +6 -0
  81. data/db/migrate/20170915215309_add_team_to_thing.rb +5 -0
  82. data/db/migrate/20171105001408_remove_api_key_from_user.rb +6 -0
  83. data/db/migrate/20180326124105_add_timezone_to_user.rb +5 -0
  84. data/db/migrate/20180902142350_create_membership_roles.rb +10 -0
  85. data/db/migrate/20180902143758_remove_admin_from_membership.rb +5 -0
  86. data/db/migrate/20180902154611_create_invitation_roles.rb +10 -0
  87. data/db/migrate/20180902154652_migrate_admin_flag_on_invitations.rb +14 -0
  88. data/db/migrate/20180902195848_remove_admin_from_invitation.rb +5 -0
  89. data/db/migrate/20180903101707_add_last_seen_at_to_users.rb +5 -0
  90. data/db/migrate/20190321203224_add_profile_photo_id_to_user.rb +5 -0
  91. data/db/migrate/20190519230202_add_ability_cache_to_user.rb +5 -0
  92. data/db/migrate/20190628194704_add_last_notification_email_sent_at_to_user.rb +5 -0
  93. data/db/migrate/20200211034208_add_invitation_to_membership.rb +5 -0
  94. data/db/migrate/20200211044616_drop_invitation_roles_table.rb +10 -0
  95. data/db/migrate/20200213052748_add_former_user_fields_to_membership.rb +8 -0
  96. data/db/migrate/20200213235037_add_former_user_to_user.rb +7 -0
  97. data/db/migrate/20200219013834_add_added_by_to_membership.rb +5 -0
  98. data/db/migrate/20200219015116_rename_from_user_to_from_membership.rb +5 -0
  99. data/db/migrate/20200726222314_add_being_destroyed_to_team.rb +5 -0
  100. data/db/migrate/20200727171308_add_devise_two_factor_to_users.rb +9 -0
  101. data/db/migrate/20200727175949_add_devise_two_factor_backupable_to_users.rb +5 -0
  102. data/db/migrate/20210304133200_add_time_zone_to_team.rb +5 -0
  103. data/db/migrate/20210816072419_add_locale_to_users.rb +5 -0
  104. data/db/migrate/20210816072508_add_locale_to_teams.rb +5 -0
  105. data/db/migrate/20211020200855_add_doorkeeper_application_to_memberships.rb +5 -0
  106. data/db/migrate/20211027002944_add_doorkeeper_application_to_users.rb +5 -0
  107. data/lib/bullet_train/engine.rb +4 -0
  108. data/lib/bullet_train/version.rb +3 -0
  109. data/lib/bullet_train.rb +6 -0
  110. data/lib/tasks/bullet_train_tasks.rake +4 -0
  111. metadata +168 -0
@@ -0,0 +1,99 @@
1
+ en:
2
+ memberships: &memberships
3
+ label: &label Team Members
4
+ singular: Team Member
5
+ navigation:
6
+ label: *label
7
+ icon: fal fa-users ti ti-flag-alt
8
+ breadcrumbs:
9
+ label: *label
10
+ buttons: &buttons
11
+ edit: Settings
12
+ show: Details
13
+ update: Update Membership
14
+ demote: Demote from Admin
15
+ promote: Promote to Admin
16
+ destroy: Remove from Team
17
+ destroy_own: Leave This Team
18
+ reinvite: Re-Invite to Team
19
+ confirmations:
20
+ destroy: Are you sure you want to remove %{membership_name} from %{team_name}?
21
+ destroy_own: Are you sure you want to remove yourself from %{team_name}? You won't be able to undo this.
22
+ reinvite: Are you sure you want to re-invite %{membership_name} to %{team_name}?
23
+ fields: &fields
24
+ name:
25
+ _: &name Full Name
26
+ heading: *name
27
+ user_first_name:
28
+ name: &user_first_name First Name
29
+ label: *user_first_name
30
+ user_last_name:
31
+ name: &user_last_name Last Name
32
+ label: *user_last_name
33
+ user_profile_photo_id:
34
+ name: &user_profile_photo_id Profile Photo
35
+ label: *user_profile_photo_id
36
+ role_ids:
37
+ name: &roles Special Privileges
38
+ label: *roles
39
+ heading: *roles
40
+ options:
41
+ default:
42
+ label: Viewer
43
+ description: Can only view team data
44
+ admin:
45
+ label: Team Administrator
46
+ description: Team administrators can manage billing and manage special privileges for other users.
47
+ editor:
48
+ label: Editor
49
+ description: Can edit all resources on this team and allow others to do the same.
50
+ none: Viewer
51
+ index:
52
+ section: "%{team_name} Team Members"
53
+ contexts:
54
+ team:
55
+ header: Team Members
56
+ description: The following people are members of your team. You can also invite new team members.
57
+ fields: *fields
58
+ buttons: *buttons
59
+ tombstones:
60
+ contexts:
61
+ team:
62
+ header: Former Team Members
63
+ description: The following people have been removed from %{team_name}, but you can still manage their profile and reassign their assignments to other team members.
64
+ buttons: *buttons
65
+ form: &form
66
+ grant_privileges_of: Grant Privileges of %{role_key}
67
+ buttons: *buttons
68
+ fields: *fields
69
+ edit:
70
+ section: "%{membership_name} on %{team_name}"
71
+ header: Update Membership Settings
72
+ description: You can edit the settings for %{memberships_possessive} membership on %{team_name} below.
73
+ grant_privileges_of: Grant Privileges of %{role_key}
74
+ remove_header: Remove Team Member
75
+ remove_description: Removing %{membership_name} won't remove any resource assignments. Instead, you'll have the option of reassigning resources to another team member. You'll also be able to re-invite %{membership_name} back to the team in the future.
76
+ buttons: *buttons
77
+ show:
78
+ section: "%{memberships_possessive} Membership on %{team_name}"
79
+ header: Membership Details
80
+ invitation_header: Invitation Details
81
+ tombstone_header: Former Team Member
82
+ description: The following are the details for %{memberships_possessive} Membership on %{team_name}.
83
+ buttons: *buttons
84
+ fields: *fields
85
+ notifications:
86
+ updated: Membership successfully updated.
87
+ destroyed: That user has been successfully removed from the team.
88
+ no_members: You don't have any other team members yet! Get started by sending an invitation.
89
+ cant_demote: Sorry, you can't demote the last admin on a team. Please make someone else an admin first.
90
+ cant_remove: Sorry, you can't remove the last admin on a team. Please make someone else an admin first.
91
+ you_removed_yourself: You've successfully removed yourself from %{team_name}.
92
+ reinvited: The user has been successfully re-invited. They will receive an email to rejoin the team.
93
+ account:
94
+ memberships: *memberships
95
+ activerecord:
96
+ attributes:
97
+ memberships:
98
+ user_first_name: *user_first_name
99
+ user_last_name: *user_last_name
@@ -0,0 +1,11 @@
1
+ # if you're looking for form fields, they're namespaced within `user.yml` and `team.yml`.
2
+ en:
3
+ onboarding: &onboarding
4
+ user_details:
5
+ buttons: &buttons
6
+ next: Next
7
+ edit:
8
+ header: Tell us about you
9
+ buttons: *buttons
10
+ account:
11
+ onboarding: *onboarding
@@ -0,0 +1,13 @@
1
+ # if you're looking for form fields, they're namespaced within `user.yml`.
2
+ en:
3
+ onboarding: &onboarding
4
+ user_email:
5
+ buttons: &buttons
6
+ next: Next
7
+ edit:
8
+ header: What's your email address?
9
+ description: We weren't able to fetch your email address from the account you used to sign in.
10
+ email_taken: Sorry, the email address you're trying to use is already associated with another account. You should sign in with your email address and password and then add this account in your account settings.
11
+ buttons: *buttons
12
+ account:
13
+ onboarding: *onboarding
@@ -0,0 +1,85 @@
1
+ en:
2
+ teams: &teams
3
+ label: &label Teams
4
+ singular: Team
5
+ breadcrumbs:
6
+ label: *label
7
+ navigation:
8
+ label: Team
9
+ buttons: &buttons
10
+ new: Add New Team
11
+ create: Create Team
12
+ edit: Edit Team
13
+ update: Update Team
14
+ index:
15
+ section: Teams
16
+ header: Your Teams
17
+ create: Create New Team
18
+ buttons: *buttons
19
+ show:
20
+ header: '%{teams_possessive} Dashboard'
21
+ new:
22
+ header: Create a New Team
23
+ former_user_header: Join a Team
24
+ buttons: *buttons
25
+ you_can: "You can either:"
26
+ invitation_header: Accept an invitation
27
+ logout_header: Log out of this account
28
+ new_team_header: Create a new team
29
+ alert: The account <b>%{user_email}</b> is not currently a member of any teams.
30
+ invitation: If you have received an email inviting you to join a new team, click the link in that email to accept the invitation.
31
+ log_out: You can log out of this account and log in with a different account that is a member of a team.
32
+ new_team: You can use the form below to create a new team of your own.
33
+ edit:
34
+ section: '%{team_name}'
35
+ header: Edit Team Details
36
+ description: You can update the details of and settings for this team below.
37
+ notifications:
38
+ created: Team was successfully created.
39
+ updated: Team was successfully updated.
40
+ invitation_only: Creating new teams is currently limited to users who have been invited for early access. If you've received an early access URL, please visit it before trying again.
41
+ form:
42
+ buttons: *buttons
43
+ fields: &fields
44
+ id:
45
+ _: &id Team ID
46
+ label: *id
47
+ heading: *id
48
+ name:
49
+ _: &name Team Name
50
+ label: *name
51
+ heading: Team
52
+ time_zone:
53
+ _: &time_zone Primary Time Zone
54
+ label: "Primary Time Zone"
55
+ heading: *time_zone
56
+ locale:
57
+ _: &locale Language
58
+ label: "Primary Language"
59
+ heading: *locale
60
+ # 🚅 super scaffolding will insert new fields above this line.
61
+ created_at:
62
+ _: &created_at Created
63
+ heading: *created_at
64
+ _: &self
65
+ name:
66
+ label: Your Team Name
67
+ self:
68
+ <<: [*self, *fields]
69
+ api:
70
+ actions: "Actions for Teams"
71
+ index: "List Teams"
72
+ create: "Add a New Team"
73
+ show: "Retrieve a Team"
74
+ update: "Update a Team"
75
+ fields: *fields
76
+ account:
77
+ teams: *teams
78
+ activerecord:
79
+ attributes:
80
+ user:
81
+ name: *name
82
+ time_zone: *time_zone
83
+ locale: *locale
84
+ # 🚅 super scaffolding will insert new activerecord attributes above this line.
85
+ created_at: *created_at
@@ -0,0 +1,110 @@
1
+ en:
2
+ users: &users
3
+ label: &label Users
4
+ breadcrumbs:
5
+ label: *label
6
+ buttons: &buttons
7
+ update_profile: Update Profile
8
+ update_password: Update Password
9
+ edit:
10
+ section: "%{users_possessive} Profile"
11
+ profile:
12
+ header: Update Your Profile
13
+ description: You can update the email address where you'll receive notifications and also update the way your name is displayed.
14
+ password:
15
+ header: Update Your Password
16
+ two_factor:
17
+ header: Two-Factor Authentication
18
+ description_enabled: 2FA is currently enabled for your account.
19
+ description_disabled: You can increase the security of your account by enabling two-factor authentication.
20
+ warning: "In order to complete set up, you <strong>must</strong> complete the steps below. <strong>The information below will not be shown again.</strong> If you don't complete setting up now, you must disable two-factor authentication to avoid being locked out of your account."
21
+ instructions: "Install <a href='https://authy.com/download/' target='_blank'>Authy</a> or <a href='https://support.google.com/accounts/answer/1066447'>Google Authentication</a> on your phone and scan the barcode displayed below."
22
+ recovery_codes: "You can also make a copy of the following recovery codes. Each one can help you get back into your account once should you lose access to the device you're using for two-factor authentication."
23
+ buttons:
24
+ enable: Enable
25
+ disable: Disable
26
+ buttons: *buttons
27
+ notifications:
28
+ updated: User was successfully updated.
29
+ fields: &fields
30
+ name:
31
+ heading: Name
32
+ first_name:
33
+ _: &first_name First Name
34
+ label: *first_name
35
+ heading: *first_name
36
+ last_name:
37
+ _: &last_name Last Name
38
+ label: *last_name
39
+ heading: *last_name
40
+ email:
41
+ _: &email Email Address
42
+ label: *email
43
+ heading: *email
44
+ time_zone:
45
+ _: &time_zone Your Time Zone
46
+ label: *time_zone
47
+ heading: *time_zone
48
+ profile_photo_id:
49
+ _: &profile_photo_id Profile Photo
50
+ label: *profile_photo_id
51
+ heading: *profile_photo_id
52
+ current_password:
53
+ label: Current Password
54
+ password:
55
+ _: &password Password
56
+ label: *password
57
+ password_confirmation:
58
+ _: &password_confirmation Password Confirmation
59
+ label: Confirm Password
60
+ locale:
61
+ _: &locale Language
62
+ label: *locale
63
+ heading: *locale
64
+ help: By default the interface language will adjust based on each team's language setting, but you can set a global personal preference for your account here.
65
+ # 🚅 super scaffolding will insert new fields above this line.
66
+ created_at:
67
+ _: &created_at Signed Up
68
+ heading: *created_at
69
+ # this is how we define customizations to fields for a specific namespace.
70
+ _: &self
71
+ email:
72
+ label: Your Email Address
73
+ password:
74
+ label: Your Password
75
+ first_name:
76
+ label: Your First Name
77
+ last_name:
78
+ label: Your Last Name
79
+ otp_attempt:
80
+ label: Two-Factor Authentication Code
81
+ help: You can find this in the authenticator application you configured when adding 2FA to your account.
82
+ self:
83
+ <<: [*self, *fields]
84
+ _1: &sign_up
85
+ password:
86
+ label: Set Password
87
+ sign_up:
88
+ <<: [*sign_up, *self, *fields]
89
+ _2: &update_self
90
+ password:
91
+ label: New Password
92
+ update_self:
93
+ <<: [*update_self, *self, *fields]
94
+ form:
95
+ buttons: *buttons
96
+ account:
97
+ users: *users
98
+ activerecord:
99
+ attributes:
100
+ user:
101
+ first_name: *first_name
102
+ last_name: *last_name
103
+ email: *email
104
+ profile_photo_id: *profile_photo_id
105
+ time_zone: *time_zone
106
+ locale: *locale
107
+ # 🚅 super scaffolding will insert new activerecord attributes above this line.
108
+ created_at: *created_at
109
+ password: *password
110
+ password_confirmation: *password_confirmation
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,41 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :users do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.inet :current_sign_in_ip
20
+ t.inet :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+ t.timestamps null: false
34
+ end
35
+
36
+ add_index :users, :email, unique: true
37
+ add_index :users, :reset_password_token, unique: true
38
+ # add_index :users, :confirmation_token, unique: true
39
+ # add_index :users, :unlock_token, unique: true
40
+ end
41
+ end
@@ -0,0 +1,6 @@
1
+ class AddApiKeyToUser < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :users, :api_key, :string
4
+ add_column :users, :api_key_generated_at, :datetime
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTeams < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :teams do |t|
4
+ t.string :name
5
+ t.string :slug
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class CreateMemberships < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :memberships do |t|
4
+ t.references :user, foreign_key: true
5
+ t.references :team, foreign_key: true
6
+ t.boolean :admin
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddCurrentTeamToUser < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :users, :current_team_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateInvitations < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :invitations do |t|
4
+ t.string :email
5
+ t.string :uuid
6
+ t.integer :from_user_id
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddTeamToInvitation < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_reference :invitations, :team, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddAdminToInvitation < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :invitations, :admin, :boolean
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddNamesToUser < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :users, :first_name, :string
4
+ add_column :users, :last_name, :string
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddTeamToThing < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_reference :things, :team, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveApiKeyFromUser < ActiveRecord::Migration[5.1]
2
+ def change
3
+ remove_column :users, :api_key, :string
4
+ remove_column :users, :api_key_generated_at, :datetime
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddTimezoneToUser < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :users, :time_zone, :string
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMembershipRoles < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :membership_roles do |t|
4
+ t.belongs_to :membership, foreign_key: true
5
+ t.belongs_to :role, foreign_key: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveAdminFromMembership < ActiveRecord::Migration[5.2]
2
+ def change
3
+ remove_column :memberships, :admin, :boolean
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateInvitationRoles < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :invitation_roles do |t|
4
+ t.references :invitation, foreign_key: true
5
+ t.references :role, foreign_key: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ class MigrateAdminFlagOnInvitations < ActiveRecord::Migration[5.2]
2
+ def up
3
+ Invitation.where(admin: true).each do |invitation|
4
+ invitation.roles = [Role.admin]
5
+ invitation.save
6
+ end
7
+ end
8
+
9
+ def down
10
+ InvitationRole.where(role: Role.admin).each do |invitation_role|
11
+ invitation_role.invitation.update_column(:admin, true)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveAdminFromInvitation < ActiveRecord::Migration[5.2]
2
+ def change
3
+ remove_column :invitations, :admin, :boolean
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLastSeenAtToUsers < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :users, :last_seen_at, :datetime
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddProfilePhotoIdToUser < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :users, :profile_photo_id, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddAbilityCacheToUser < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :users, :ability_cache, :jsonb
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLastNotificationEmailSentAtToUser < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :users, :last_notification_email_sent_at, :datetime
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddInvitationToMembership < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_reference :memberships, :invitation, null: true, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class DropInvitationRolesTable < ActiveRecord::Migration[6.0]
2
+ def change
3
+ drop_table :invitation_roles do |t|
4
+ t.references :invitation, foreign_key: true
5
+ t.references :role, foreign_key: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class AddFormerUserFieldsToMembership < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :memberships, :user_first_name, :string
4
+ add_column :memberships, :user_last_name, :string
5
+ add_column :memberships, :user_profile_photo_id, :string
6
+ add_column :memberships, :user_email, :string
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class AddFormerUserToUser < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :former_user, :boolean, default: false
4
+ User.update_all(former_user: false)
5
+ change_column_null :users, :former_user, false, false
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddAddedByToMembership < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_reference :memberships, :added_by, null: true, foreign_key: {to_table: :memberships}
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenameFromUserToFromMembership < ActiveRecord::Migration[6.0]
2
+ def change
3
+ rename_column :invitations, :from_user_id, :from_membership_id
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddBeingDestroyedToTeam < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :teams, :being_destroyed, :boolean
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :encrypted_otp_secret, :string
4
+ add_column :users, :encrypted_otp_secret_iv, :string
5
+ add_column :users, :encrypted_otp_secret_salt, :string
6
+ add_column :users, :consumed_timestep, :integer
7
+ add_column :users, :otp_required_for_login, :boolean
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :otp_backup_codes, :string, array: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddTimeZoneToTeam < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :teams, :time_zone, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLocaleToUsers < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :users, :locale, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLocaleToTeams < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :teams, :locale, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDoorkeeperApplicationToMemberships < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_reference :memberships, :platform_agent_of, null: true, foreign_key: {to_table: "oauth_applications"}
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDoorkeeperApplicationToUsers < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_reference :users, :platform_agent_of, null: true, foreign_key: {to_table: "oauth_applications"}
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module BulletTrain
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end