Created
April 7, 2023 20:05
-
-
Save bondarolik/4d6a33dc5246a445a12f9a3c24d53597 to your computer and use it in GitHub Desktop.
User Table Creation and Data Population within Rake task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run rake task from migration file | |
class CreateUsers < ActiveRecord::Migration [7.0] | |
def change | |
create_table :users do It| t.string :first_name t.string :last_name | |
t. string email, index: { unique: true } | |
# other columns | |
t. timestamps | |
end | |
up_only do | |
# just an example, don't @ me | |
Rake: :Task[ users :populate_known_emails ']. invoke end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment