Compare commits
2 Commits
24c39f331a
...
ce7f32c407
Author | SHA1 | Date | |
---|---|---|---|
ce7f32c407 | |||
d3d3a35c19 |
13
app/models/wedding.rb
Normal file
13
app/models/wedding.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Copyright (C) 2024 Manuel Bustillo
|
||||||
|
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: weddings
|
||||||
|
#
|
||||||
|
# id :uuid not null, primary key
|
||||||
|
# date :date
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
class Wedding < ApplicationRecord
|
||||||
|
end
|
11
db/migrate/20241130182228_create_weddings.rb
Normal file
11
db/migrate/20241130182228_create_weddings.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Copyright (C) 2024 Manuel Bustillo
|
||||||
|
|
||||||
|
class CreateWeddings < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :weddings, id: :uuid do |t|
|
||||||
|
t.date :date
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
8
db/schema.rb
generated
8
db/schema.rb
generated
@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do
|
ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
@ -208,6 +208,12 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do
|
|||||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
|
t.date "date"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
add_foreign_key "groups", "groups", column: "parent_id"
|
add_foreign_key "groups", "groups", column: "parent_id"
|
||||||
add_foreign_key "guests", "groups"
|
add_foreign_key "guests", "groups"
|
||||||
add_foreign_key "seats", "guests"
|
add_foreign_key "seats", "guests"
|
||||||
|
@ -7,6 +7,10 @@ Expense.delete_all
|
|||||||
Guest.delete_all
|
Guest.delete_all
|
||||||
Group.delete_all
|
Group.delete_all
|
||||||
|
|
||||||
|
Wedding.delete_all
|
||||||
|
|
||||||
|
Wedding.create!(date: 1.year.from_now)
|
||||||
|
|
||||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||||
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||||
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
||||||
|
7
spec/factories/weddings.rb
Normal file
7
spec/factories/weddings.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Copyright (C) 2024 Manuel Bustillo
|
||||||
|
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :wedding do
|
||||||
|
date { 1.year.from_now }
|
||||||
|
end
|
||||||
|
end
|
7
spec/models/wedding_spec.rb
Normal file
7
spec/models/wedding_spec.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Copyright (C) 2024 Manuel Bustillo
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Wedding, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user