Compare commits
1 Commits
ce7f32c407
...
24c39f331a
Author | SHA1 | Date | |
---|---|---|---|
24c39f331a |
@ -1,13 +1,18 @@
|
|||||||
# Copyright (C) 2024 Manuel Bustillo
|
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: weddings
|
# Table name: weddings
|
||||||
#
|
#
|
||||||
# id :uuid not null, primary key
|
# id :uuid not null, primary key
|
||||||
# date :date
|
# date :date not null
|
||||||
|
# slug :string not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
#
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_weddings_on_slug (slug) UNIQUE
|
||||||
|
#
|
||||||
class Wedding < ApplicationRecord
|
class Wedding < ApplicationRecord
|
||||||
|
validates :date, presence: true
|
||||||
|
validates :slug, presence: true, uniqueness: true
|
||||||
end
|
end
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Copyright (C) 2024 Manuel Bustillo
|
|
||||||
|
|
||||||
class CreateWeddings < ActiveRecord::Migration[8.0]
|
class CreateWeddings < ActiveRecord::Migration[8.0]
|
||||||
def change
|
def change
|
||||||
create_table :weddings, id: :uuid do |t|
|
create_table :weddings, id: :uuid do |t|
|
||||||
t.date :date
|
t.string :slug, null: false, index: { unique: true }
|
||||||
|
t.date :date, null: false
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
6
db/schema.rb
generated
6
db/schema.rb
generated
@ -1,5 +1,3 @@
|
|||||||
# Copyright (C) 2024 Manuel Bustillo
|
|
||||||
|
|
||||||
# This file is auto-generated from the current state of the database. Instead
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
# of editing this file, please use the migrations feature of Active Record to
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
@ -209,9 +207,11 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
t.date "date"
|
t.string "slug", null: false
|
||||||
|
t.date "date", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["slug"], name: "index_weddings_on_slug", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key "groups", "groups", column: "parent_id"
|
add_foreign_key "groups", "groups", column: "parent_id"
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# Copyright (C) 2024 Manuel Bustillo
|
|
||||||
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :wedding do
|
factory :wedding do
|
||||||
date { 1.year.from_now }
|
date { 1.year.from_now }
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# Copyright (C) 2024 Manuel Bustillo
|
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Wedding, type: :model do
|
RSpec.describe Wedding, type: :model do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user