Skip to content
Snippets Groups Projects
Commit 336d2045 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

posts

parent 8b262096
No related branches found
No related tags found
No related merge requests found
# == Schema Information
#
# Table name: communication_extranet_posts
#
# id :uuid not null, primary key
# featured_image_alt :string
# featured_image_credit :text
# published :boolean default(FALSE)
# published_at :datetime
# slug :string
# summary :text
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# author_id :uuid indexed
# extranet_id :uuid not null, indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_extranet_posts_on_author_id (author_id)
# index_communication_extranet_posts_on_extranet_id (extranet_id)
# index_communication_extranet_posts_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_0232de42a1 (university_id => universities.id)
# fk_rails_4341823eab (extranet_id => communication_extranets.id)
# fk_rails_86cc935add (author_id => university_people.id)
#
class Communication::Extranet::Post < ApplicationRecord
include Sanitizable
include WithUniversity
include WithFeaturedImage
include WithBlocks
include WithPermalink
include WithSlug
belongs_to :author, class_name: 'University::Person'
belongs_to :extranet, class_name: 'Communication::Extranet'
end
class CreateCommunicationExtranetPosts < ActiveRecord::Migration[7.0]
def change
create_table :communication_extranet_posts, id: :uuid do |t|
t.string :title
t.boolean :published, default: false
t.datetime :published_at
t.references :author, foreign_key: {to_table: :university_people}, type: :uuid
t.references :extranet, null: false, foreign_key: {to_table: :communication_extranets}, type: :uuid
t.references :university, null: false, foreign_key: true, type: :uuid
t.string :featured_image_alt
t.text :featured_image_credit
t.string :slug
t.text :summary
t.timestamps
end
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_03_06_153945) do
ActiveRecord::Schema[7.0].define(version: 2023_03_07_145748) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
......@@ -105,6 +105,24 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_06_153945) do
t.index ["university_id"], name: "index_communication_extranet_connections_on_university_id"
end
create_table "communication_extranet_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "title"
t.boolean "published", default: false
t.datetime "published_at"
t.uuid "author_id"
t.uuid "extranet_id", null: false
t.uuid "university_id", null: false
t.string "featured_image_alt"
t.text "featured_image_credit"
t.string "slug"
t.text "summary"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["author_id"], name: "index_communication_extranet_posts_on_author_id"
t.index ["extranet_id"], name: "index_communication_extranet_posts_on_extranet_id"
t.index ["university_id"], name: "index_communication_extranet_posts_on_university_id"
end
create_table "communication_extranets", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
t.string "name"
t.uuid "university_id", null: false
......@@ -966,6 +984,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_06_153945) do
add_foreign_key "communication_blocks", "universities"
add_foreign_key "communication_extranet_connections", "communication_extranets", column: "extranet_id"
add_foreign_key "communication_extranet_connections", "universities"
add_foreign_key "communication_extranet_posts", "communication_extranets", column: "extranet_id"
add_foreign_key "communication_extranet_posts", "universities"
add_foreign_key "communication_extranet_posts", "university_people", column: "author_id"
add_foreign_key "communication_extranets", "universities"
add_foreign_key "communication_website_categories", "communication_website_categories", column: "original_id"
add_foreign_key "communication_website_categories", "communication_website_categories", column: "parent_id"
......
# == Schema Information
#
# Table name: communication_extranet_posts
#
# id :uuid not null, primary key
# featured_image_alt :string
# featured_image_credit :text
# published :boolean default(FALSE)
# published_at :datetime
# slug :string
# summary :text
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# author_id :uuid indexed
# extranet_id :uuid not null, indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_extranet_posts_on_author_id (author_id)
# index_communication_extranet_posts_on_extranet_id (extranet_id)
# index_communication_extranet_posts_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_0232de42a1 (university_id => universities.id)
# fk_rails_4341823eab (extranet_id => communication_extranets.id)
# fk_rails_86cc935add (author_id => university_people.id)
#
one:
title: MyString
published: false
published_at: 2023-03-07 15:57:51
author: one
extranet: one
university: one
featured_image_alt: MyString
featured_image_credit: MyText
slug: MyString
summary: MyText
language: one
original: one
two:
title: MyString
published: false
published_at: 2023-03-07 15:57:51
author: two
extranet: two
university: two
featured_image_alt: MyString
featured_image_credit: MyText
slug: MyString
summary: MyText
language: two
original: two
# == Schema Information
#
# Table name: communication_extranet_posts
#
# id :uuid not null, primary key
# featured_image_alt :string
# featured_image_credit :text
# published :boolean default(FALSE)
# published_at :datetime
# slug :string
# summary :text
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# author_id :uuid indexed
# extranet_id :uuid not null, indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_extranet_posts_on_author_id (author_id)
# index_communication_extranet_posts_on_extranet_id (extranet_id)
# index_communication_extranet_posts_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_0232de42a1 (university_id => universities.id)
# fk_rails_4341823eab (extranet_id => communication_extranets.id)
# fk_rails_86cc935add (author_id => university_people.id)
#
require "test_helper"
class Communication::Extranet::PostTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment