member model
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class CreateMembers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :members do |t|
|
||||
t.string :nick, null: false
|
||||
t.string :real_nick, null: false
|
||||
t.text :motto
|
||||
t.string :avatar_filename
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
+10
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_05_05_000005) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_05_05_000006) do
|
||||
create_table "admin_users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "email", default: "", null: false
|
||||
@@ -145,6 +145,15 @@ ActiveRecord::Schema[8.1].define(version: 2026_05_05_000005) do
|
||||
t.index ["username"], name: "users_username_unique", unique: true
|
||||
end
|
||||
|
||||
create_table "members", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "avatar_filename"
|
||||
t.datetime "created_at", null: false
|
||||
t.text "motto"
|
||||
t.string "nick", null: false
|
||||
t.string "real_nick", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "releases", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "cartridge_path"
|
||||
t.datetime "created_at", precision: 3
|
||||
|
||||
@@ -2,3 +2,16 @@ AdminUser.find_or_create_by!(email: ENV.fetch("ADMIN_EMAIL", "admin@teletype.hu"
|
||||
user.password = ENV.fetch("ADMIN_PASSWORD", "password123")
|
||||
user.password_confirmation = ENV.fetch("ADMIN_PASSWORD", "password123")
|
||||
end
|
||||
|
||||
[
|
||||
{ nick: "Mr. Zero", real_nick: "Tasi", motto: "His dream is to become an open-source knight.", avatar_filename: "mr.zero.png" },
|
||||
{ nick: "Mr. One", real_nick: "Ballz", motto: "The cheese is half-eaten. Something here went very wrong.", avatar_filename: "mr.one.png" },
|
||||
{ nick: "Mr. Two", real_nick: "Z", motto: "The egg was first or the chicken? It doesn't matter, we eat both.", avatar_filename: "mr.two.png" },
|
||||
{ nick: "Mr. Three", real_nick: "gBird", motto: "Life is beautiful because it contains the possibility of becoming human.", avatar_filename: "mr.three.png" },
|
||||
].each do |attrs|
|
||||
Member.find_or_create_by!(nick: attrs[:nick]) do |m|
|
||||
m.real_nick = attrs[:real_nick]
|
||||
m.motto = attrs[:motto]
|
||||
m.avatar_filename = attrs[:avatar_filename]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user