1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- User.delete_all
- User.reset_pk_sequence
- Activity.delete_all
- Activity.reset_pk_sequence
- JoinedUserActivity.delete_all
- JoinedUserActivity.reset_pk_sequence
- Task.delete_all
- Task.reset_pk_sequence
- Team.delete_all
- Team.reset_pk_sequence
- JoinedTeamUser.delete_all
- JoinedTeamUser.reset_pk_sequence
-
- 3.times do |i|
- team = Team.create(name: Faker::Company.name, description: Faker::Company.catch_phrase)
- puts "Created TEAM ##{i} - #{team.name}"
- end
-
- 10.times do |i|
- name = Faker::Name.first_name.downcase
- user = User.create! username: "#{name}", email: "#{name}@email.com", password: "azerty"
- puts "Created USER ##{i} - #{user.username}"
-
- 2.times do
- activity = Activity.create!(
- name: Faker::Science.element,
- client: Faker::Company.name,
- description: Faker::Company.catch_phrase,
- author_id: user.id
- )
- puts "Created ACTIVITY \"#{activity.name}\" for #{activity.client}"
-
- joined_user_activity = JoinedUserActivity.create!(
- user_id: user.id,
- activity_id: activity.id
- )
- puts "Created ASSOCIATION ##{joined_user_activity.id}"
- end
-
- joined_team_users = JoinedTeamUser.create!(
- user_id: user.id,
- team_id: Team.all.sample.id
- )
- end
-
- User.create! username: "admin", email: "admin@email.com", password: "azerty", is_admin: true
- puts "Created Admin"
-
- 30.times do |i|
- task = Task.create(
- name: Faker::Fantasy::Tolkien.character,
- description: Faker::Fantasy::Tolkien.poem,
- duration: rand(1..120),
- user_id: User.all.sample.id,
- activity_id: Activity.all.sample.id
- )
- puts "Created TASK ##{i} - #{task.name}"
- end
|