Merge pull request #2 from teste-de-progresso/fix/review-request-constraint

fix review request constraint
This commit is contained in:
João Geonizeli
2023-05-03 21:24:15 -03:00
committed by GitHub
6 changed files with 18 additions and 7 deletions

View File

@@ -1,16 +1,20 @@
# Requisitos
- Docker (Gerenciador de container)
[Instalando Docker no Windows](https://docs.docker.com/desktop/install/windows-install/)
# Setup
- Execute `./scripts/setup` para gerar a base do container, esse processo pode demorar um pouco pois será baixada todas as depêndencias do projeto, libs e banco de dados.
# Levantar a aplicação
- Execute `docker-compose up`
# Executar comandos no container
- Execute `./scripts/bash` para executar comandos você precisa entrar no console do container, agora você poderar por exemplo rodar as migrações de dados.
- Execute `rails db:migration` para rodar as migrações no banco de dados.
- Execute `rails db:migrate` para rodar as migrações no banco de dados.
- Execute `bundle exec rake environment "user:create_admin[sem.email@example.com, Seu nome]"` para criar seu usuário
- Execute `rails db:seed` para popular o banco com os assuntos, exios e categorias
- Execute `rails db:seed` para popular o banco com os assuntos, exios e categorias

View File

@@ -3,7 +3,7 @@
# Table name: review_requests
#
# id :bigint not null, primary key
# answered :string
# answered :string not null
# created_at :datetime not null
# updated_at :datetime not null
# question_id :bigint not null

View File

@@ -0,0 +1,7 @@
class ChangeReviewRequestAnsweredToNotNil < ActiveRecord::Migration[7.0]
def change
ReviewRequest.where(answered: nil).update_all(answered: false)
change_column_null :review_requests, :answered, false
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do
ActiveRecord::Schema[7.0].define(version: 2023_05_04_002009) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -110,7 +110,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do
end
create_table "review_requests", force: :cascade do |t|
t.string "answered"
t.string "answered", null: false
t.bigint "question_id", null: false
t.bigint "user_id", null: false
t.datetime "created_at", null: false

View File

@@ -3,7 +3,7 @@
# Table name: review_requests
#
# id :bigint not null, primary key
# answered :string
# answered :string not null
# created_at :datetime not null
# updated_at :datetime not null
# question_id :bigint not null

View File

@@ -3,7 +3,7 @@
# Table name: review_requests
#
# id :bigint not null, primary key
# answered :string
# answered :string not null
# created_at :datetime not null
# updated_at :datetime not null
# question_id :bigint not null