Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# This file should ensure the existence of records required to run the application in every environment (production,
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Example:
#
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
# MovieGenre.find_or_create_by!(name: genre_name)
# end

if Rails.env.development?
puts "Seeding base users..."

roles = User.roles.keys

roles.each do |role|
email = "#{role}@zenrunner.com"

User.find_or_create_by!(email: email) do |user|
user.name = "#{role.capitalize} User"
user.password = "password123"
user.password_confirmation = "password123"
user.role = role
end
end

puts "Users seeded successfully!"
end
9 changes: 9 additions & 0 deletions setup_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -e

echo "Setting up the database using Docker..."

bundle exec rails db:create db:migrate db:seed

echo "Database setup complete!"
Loading