Migrate to Rais 8.0
- Remove all Rodauth stuff and implement simple custom auth - Migrate from sprockets to propshaft, hack some bootstrap stuff
This commit is contained in:
parent
0198a22278
commit
c35c7da6e0
66 changed files with 518 additions and 684 deletions
11
db/migrate/20241108175901_create_users.rb
Normal file
11
db/migrate/20241108175901_create_users.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class CreateUsers < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :users do |t|
|
||||
t.string :email_address, null: false
|
||||
t.string :password_digest, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :users, :email_address, unique: true
|
||||
end
|
||||
end
|
||||
11
db/migrate/20241108175905_create_sessions.rb
Normal file
11
db/migrate/20241108175905_create_sessions.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class CreateSessions < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :sessions do |t|
|
||||
t.references :user, null: false, foreign_key: true
|
||||
t.string :ip_address
|
||||
t.string :user_agent
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
17
db/migrate/20241108180654_drop_accounts.rb
Normal file
17
db/migrate/20241108180654_drop_accounts.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class DropAccounts < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
# Used by the remember me feature
|
||||
drop_table :account_remember_keys, id: false do |t|
|
||||
t.integer :id, primary_key: true
|
||||
t.foreign_key :accounts, column: :id
|
||||
t.string :key, null: false
|
||||
t.datetime :deadline, null: false
|
||||
end
|
||||
drop_table :accounts do |t|
|
||||
t.integer :status, null: false, default: 1
|
||||
t.string :email, null: false
|
||||
t.index :email, unique: true, where: "status IN (1, 2)"
|
||||
t.string :password_hash
|
||||
end
|
||||
end
|
||||
end
|
||||
33
db/schema.rb
generated
33
db/schema.rb
generated
|
|
@ -10,19 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_11_01_125547) do
|
||||
create_table "account_remember_keys", force: :cascade do |t|
|
||||
t.string "key", null: false
|
||||
t.datetime "deadline", null: false
|
||||
end
|
||||
|
||||
create_table "accounts", force: :cascade do |t|
|
||||
t.integer "status", default: 1, null: false
|
||||
t.string "email", null: false
|
||||
t.string "password_hash"
|
||||
t.index ["email"], name: "index_accounts_on_email", unique: true, where: "status IN (1, 2)"
|
||||
end
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2024_11_08_180654) do
|
||||
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "body"
|
||||
|
|
@ -174,6 +162,15 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_125547) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "sessions", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "ip_address"
|
||||
t.string "user_agent"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["user_id"], name: "index_sessions_on_user_id"
|
||||
end
|
||||
|
||||
create_table "standards", force: :cascade do |t|
|
||||
t.string "name_de"
|
||||
t.string "name_en"
|
||||
|
|
@ -199,7 +196,14 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_125547) do
|
|||
t.index ["element_id"], name: "index_success_criteria_on_element_id"
|
||||
end
|
||||
|
||||
add_foreign_key "account_remember_keys", "accounts", column: "id"
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email_address", null: false
|
||||
t.string "password_digest", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email_address"], name: "index_users_on_email_address", unique: true
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "checklist_entries", "checklists"
|
||||
|
|
@ -208,6 +212,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_125547) do
|
|||
add_foreign_key "elements", "pages"
|
||||
add_foreign_key "links", "link_categories"
|
||||
add_foreign_key "pages", "reports"
|
||||
add_foreign_key "sessions", "users"
|
||||
add_foreign_key "success_criteria", "checks"
|
||||
add_foreign_key "success_criteria", "elements"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -91,5 +91,5 @@ Link.create!(url: "https://www.a11yproject.com/",
|
|||
description: "The A11Y Project is a community-driven effort to make digital accessibility easier.",
|
||||
link_category: LinkCategory.find_by(name: "Artikel"))
|
||||
|
||||
Account.find_or_initialize_by(email: "admin@example.com").update!(password: "password")
|
||||
Account.find_or_initialize_by(email: "goran@quiet.ch").update!(password: "password")
|
||||
User.find_or_initialize_by(email_address: "admin@example.com").update!(password: "password")
|
||||
User.find_or_initialize_by(email_address: "goran@quiet.ch").update!(password: "password")
|
||||
Loading…
Add table
Add a link
Reference in a new issue