Correção falha na migration da ultima atualização
This commit is contained in:
BIN
Erros/Imagem colada.png
Normal file
BIN
Erros/Imagem colada.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
@@ -19,7 +19,12 @@ class CreateNotificacaoContatos < ActiveRecord::Migration[7.1]
|
|||||||
add_index :grupos_contato, 'LOWER(nome)', unique: true, name: 'index_grupos_contato_nome_unico'
|
add_index :grupos_contato, 'LOWER(nome)', unique: true, name: 'index_grupos_contato_nome_unico'
|
||||||
|
|
||||||
create_table :contatos do |t|
|
create_table :contatos do |t|
|
||||||
t.references :grupo_contato, foreign_key: true, index: true
|
# ⚠️ `to_table:` é OBRIGATÓRIO aqui. Com `foreign_key: true` o Rails
|
||||||
|
# PLURALIZA o nome da referência para achar a tabela alvo, e o Inflector
|
||||||
|
# não fala português: `grupo_contato` → "grupo_contatos" e
|
||||||
|
# `evento_notificacao` → "evento_notificacaos". As tabelas reais são
|
||||||
|
# `grupos_contato` e `eventos_notificacao` (plural no primeiro termo).
|
||||||
|
t.references :grupo_contato, foreign_key: { to_table: :grupos_contato }, index: true
|
||||||
|
|
||||||
t.string :nome, null: false
|
t.string :nome, null: false
|
||||||
# E.164 normalizado (+5511920051157). Vazio = contato só de e-mail.
|
# E.164 normalizado (+5511920051157). Vazio = contato só de e-mail.
|
||||||
|
|||||||
@@ -36,8 +36,13 @@ class CreateNotificacaoEventos < ActiveRecord::Migration[7.1]
|
|||||||
add_index :eventos_notificacao, :chave, unique: true
|
add_index :eventos_notificacao, :chave, unique: true
|
||||||
|
|
||||||
create_table :grupo_evento_assinaturas do |t|
|
create_table :grupo_evento_assinaturas do |t|
|
||||||
t.references :grupo_contato, null: false, foreign_key: true
|
# ⚠️ `to_table:` é OBRIGATÓRIO aqui. Com `foreign_key: true` o Rails
|
||||||
t.references :evento_notificacao, null: false, foreign_key: true
|
# PLURALIZA o nome da referência para achar a tabela alvo, e o Inflector
|
||||||
|
# não fala português: `grupo_contato` → "grupo_contatos" e
|
||||||
|
# `evento_notificacao` → "evento_notificacaos". As tabelas reais são
|
||||||
|
# `grupos_contato` e `eventos_notificacao` (plural no primeiro termo).
|
||||||
|
t.references :grupo_contato, null: false, foreign_key: { to_table: :grupos_contato }
|
||||||
|
t.references :evento_notificacao, null: false, foreign_key: { to_table: :eventos_notificacao }
|
||||||
t.string :canal, null: false, default: 'ambos' # ambos | whatsapp | email
|
t.string :canal, null: false, default: 'ambos' # ambos | whatsapp | email
|
||||||
t.boolean :ativo, null: false, default: true
|
t.boolean :ativo, null: false, default: true
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|||||||
@@ -9,7 +9,12 @@
|
|||||||
class CreateNotificacaoEnvios < ActiveRecord::Migration[7.1]
|
class CreateNotificacaoEnvios < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
create_table :notificacao_envios do |t|
|
create_table :notificacao_envios do |t|
|
||||||
t.references :evento_notificacao, foreign_key: true, index: true
|
# ⚠️ `to_table:` é OBRIGATÓRIO aqui. Com `foreign_key: true` o Rails
|
||||||
|
# PLURALIZA o nome da referência para achar a tabela alvo, e o Inflector
|
||||||
|
# não fala português: `grupo_contato` → "grupo_contatos" e
|
||||||
|
# `evento_notificacao` → "evento_notificacaos". As tabelas reais são
|
||||||
|
# `grupos_contato` e `eventos_notificacao` (plural no primeiro termo).
|
||||||
|
t.references :evento_notificacao, foreign_key: { to_table: :eventos_notificacao }, index: true
|
||||||
t.references :contato, foreign_key: true, index: true
|
t.references :contato, foreign_key: true, index: true
|
||||||
t.references :user, foreign_key: true, index: true
|
t.references :user, foreign_key: true, index: true
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,12 @@
|
|||||||
class CreateMensagemTemplates < ActiveRecord::Migration[7.1]
|
class CreateMensagemTemplates < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
create_table :mensagem_templates do |t|
|
create_table :mensagem_templates do |t|
|
||||||
t.references :evento_notificacao, null: false, foreign_key: true
|
# ⚠️ `to_table:` é OBRIGATÓRIO aqui. Com `foreign_key: true` o Rails
|
||||||
|
# PLURALIZA o nome da referência para achar a tabela alvo, e o Inflector
|
||||||
|
# não fala português: `grupo_contato` → "grupo_contatos" e
|
||||||
|
# `evento_notificacao` → "evento_notificacaos". As tabelas reais são
|
||||||
|
# `grupos_contato` e `eventos_notificacao` (plural no primeiro termo).
|
||||||
|
t.references :evento_notificacao, null: false, foreign_key: { to_table: :eventos_notificacao }
|
||||||
|
|
||||||
t.string :canal, null: false # whatsapp | email
|
t.string :canal, null: false # whatsapp | email
|
||||||
t.string :assunto # só e-mail
|
t.string :assunto # só e-mail
|
||||||
|
|||||||
Reference in New Issue
Block a user