diff --git a/.gitignore b/.gitignore index eaae597..54eaf98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.env -.idea/ \ No newline at end of file +.idea/ +aplicar.py \ No newline at end of file diff --git a/python/dataload.ipynb b/python/dataload.ipynb index d22b14f..d5f2538 100644 --- a/python/dataload.ipynb +++ b/python/dataload.ipynb @@ -9,17 +9,24 @@ "end_time": "2026-07-12T17:37:32.831863Z", "start_time": "2026-07-12T17:37:32.806752900Z" }, - "collapsed": true + "collapsed": true, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:14.977781Z", + "iopub.status.busy": "2026-10-04T01:05:14.977460Z", + "iopub.status.idle": "2026-10-04T01:05:16.774267Z", + "shell.execute_reply": "2026-10-04T01:05:16.772494Z" + } }, "outputs": [], "source": [ "# fazendo importações\n", "import os\n", - "from random import choice, choices, randint, triangular\n", + "from random import choice, choices, randint, triangular\n", + "from datetime import date, timedelta\n", "from dotenv import load_dotenv\n", "from faker import Faker\n", "import pandas as pd\n", - "from sqlalchemy import create_engine, text\n", + "from sqlalchemy import Date, create_engine, text\n", "from sqlalchemy.dialects.postgresql import UUID\n", "from re import sub\n", "from unicodedata import normalize\n", @@ -35,6 +42,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:37:32.849378900Z", "start_time": "2026-07-12T17:37:32.833862400Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:16.778282Z", + "iopub.status.busy": "2026-10-04T01:05:16.777758Z", + "iopub.status.idle": "2026-10-04T01:05:17.496712Z", + "shell.execute_reply": "2026-10-04T01:05:17.495253Z" } }, "outputs": [], @@ -44,7 +57,18 @@ "\n", "DATABASE_URL = os.getenv(\"URL_SEGUNDO_BANCO\")\n", "engine = create_engine(DATABASE_URL)\n", - "faker = Faker(\"pt_BR\")" + "faker = Faker(\"pt_BR\")\n", + "hoje = date.today()\n", + "inicio_periodo = hoje - timedelta(days=730)\n", + "\n", + "def data_aleatoria(inicio=inicio_periodo, fim=hoje):\n", + " return faker.date_between_dates(date_start=inicio, date_end=fim)\n", + "\n", + "def data_prazo(inicio=inicio_periodo, fim=hoje):\n", + " data_base = data_aleatoria(inicio, fim)\n", + " if data_base < hoje and choice([True, False]):\n", + " return data_base + timedelta(days=randint(1, min(120, (hoje - data_base).days)))\n", + " return data_base + timedelta(days=randint(7, 120))" ] }, { @@ -55,12 +79,29 @@ "ExecuteTime": { "end_time": "2026-07-12T17:37:32.873825500Z", "start_time": "2026-07-12T17:37:32.855390700Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:17.501078Z", + "iopub.status.busy": "2026-10-04T01:05:17.500590Z", + "iopub.status.idle": "2026-10-04T01:05:17.508462Z", + "shell.execute_reply": "2026-10-04T01:05:17.506627Z" } }, "outputs": [], "source": [ "# constantes\n", - "QTD_EMPRESAS = 20\n", + "QTD_EMPRESAS = 10\n", + "QTD_COLABORADORES_MIN = 5\n", + "QTD_COLABORADORES_MAX = 10\n", + "QTD_CICLOS_FIXOS = 3\n", + "QTD_CICLOS_MIN = 1\n", + "QTD_CICLOS_MAX = 3\n", + "QTD_PROBLEMAS_MIN = 1\n", + "QTD_PROBLEMAS_MAX = 3\n", + "QTD_TAREFAS_MIN = 1\n", + "QTD_TAREFAS_MAX = 3\n", + "QTD_EFEITOS_MIN = 1\n", + "QTD_EFEITOS_MAX = 5\n", "USUARIOS_FIXOS = {\n", " 1: ('Gabriel Pibbles', 'gabetvigna@gmail.com', 'TmKtk3dmZdcmOBUSfXexpFhLdCm2', 'ADMIN'),\n", " 2: ('Lucas Almeida Plebe', 'lucas.almeidacosta09@gmail.com', '8BQy7GRasKZSkoGjl91iom6vFlF3', 'COLABORADOR'),\n", @@ -76,6 +117,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:37:32.899721300Z", "start_time": "2026-07-12T17:37:32.874826400Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:17.512382Z", + "iopub.status.busy": "2026-10-04T01:05:17.512023Z", + "iopub.status.idle": "2026-10-04T01:05:17.524504Z", + "shell.execute_reply": "2026-10-04T01:05:17.522108Z" } }, "outputs": [], @@ -83,6 +130,8 @@ "# utilitários\n", "quantidade_dependencias = [1, 2, 3, 4]\n", "\n", + "status_ciclo = ['PLANEJAMENTO', 'EXECUCAO', 'VERIFICACAO', 'PADRONIZACAO', 'CONCLUIDO', 'CANCELADO', 'PAUSADO']\n", + "\n", "provedores_email = ['gmail.com', 'hotmail.com', 'outlook.com', 'yahoo.com.br']\n", "\n", "tamanho_empresa = ['PEQUENA', 'MEDIA', 'GRANDE']\n", @@ -116,6 +165,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:37:32.916971600Z", "start_time": "2026-07-12T17:37:32.902725200Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:17.530243Z", + "iopub.status.busy": "2026-10-04T01:05:17.529707Z", + "iopub.status.idle": "2026-10-04T01:05:17.541383Z", + "shell.execute_reply": "2026-10-04T01:05:17.539214Z" } }, "outputs": [], @@ -127,6 +182,15 @@ "def apenas_numeros(valor: str) -> str:\n", " return sub(r'\\D', '', valor)\n", "\n", + "cpfs_gerados = set()\n", + "\n", + "def gerar_cpf_unico() -> str:\n", + " cpf = apenas_numeros(faker.cpf())\n", + " while cpf in cpfs_gerados:\n", + " cpf = apenas_numeros(faker.cpf())\n", + " cpfs_gerados.add(cpf)\n", + " return cpf\n", + "\n", "def gerar_lista_ids(limite: int) -> list:\n", " return list(range(1, limite + 1))\n", "\n", @@ -149,6 +213,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:37:32.942830900Z", "start_time": "2026-07-12T17:37:32.930284400Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:17.544849Z", + "iopub.status.busy": "2026-10-04T01:05:17.544491Z", + "iopub.status.idle": "2026-10-04T01:05:17.585100Z", + "shell.execute_reply": "2026-10-04T01:05:17.583696Z" } }, "outputs": [], @@ -211,6 +281,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.560830600Z", "start_time": "2026-07-12T17:37:32.944827800Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:17.590332Z", + "iopub.status.busy": "2026-10-04T01:05:17.589650Z", + "iopub.status.idle": "2026-10-04T01:05:18.601173Z", + "shell.execute_reply": "2026-10-04T01:05:18.599623Z" } }, "outputs": [], @@ -258,11 +334,11 @@ " 'nickname': nome,\n", " 'id_empresa': empresa_usuario,\n", " 'id_usuario': id,\n", - " 'cpf': apenas_numeros(faker.cpf()),\n", + " 'cpf': gerar_cpf_unico(),\n", " 'cargo': faker.job()[:100],\n", " 'area': choice(areas),\n", " 'data_nascimento': faker.date_of_birth(minimum_age=18, maximum_age=70),\n", - " 'data_contratacao': faker.date_this_decade(),\n", + " 'data_contratacao': data_aleatoria(date(hoje.year - 10, 1, 1), hoje),\n", " 'permissao_gestor': True if tipo == 'GESTOR' or tipo == 'ADMIN' else False,\n", " 'status': 'ATIVO'\n", " })\n", @@ -274,7 +350,7 @@ "\n", "id = 1\n", "for id_empresa in lista_id_empresa:\n", - " qtd_colaboradores = randint(4, 29)\n", + " qtd_colaboradores = randint(QTD_COLABORADORES_MIN, QTD_COLABORADORES_MAX)\n", "\n", " # gerar gestor\n", " gerar_colaborador(id_empresa, 'GESTOR', id)\n", @@ -294,27 +370,37 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.639126800Z", "start_time": "2026-07-12T17:38:16.607711700Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:18.604468Z", + "iopub.status.busy": "2026-10-04T01:05:18.604108Z", + "iopub.status.idle": "2026-10-04T01:05:18.988004Z", + "shell.execute_reply": "2026-10-04T01:05:18.986375Z" } }, "outputs": [], "source": [ - "# informações do ciclo\n", + "# informacoes do ciclo\n", "dados_ciclo = []\n", "gestor_ciclo = pd.DataFrame(dados_colaborador).groupby('id_empresa').first().reset_index()\n", "\n", "for _, gestor in gestor_ciclo.iterrows():\n", - " dados_ciclo.append({\n", - " 'id_empresa': gestor['id_empresa'],\n", - " 'id_responsavel': gestor['id_usuario'],\n", - " 'id_ishikawa_mongo': uuid4(),\n", - " 'titulo': faker.sentence(nb_words=5),\n", - " 'descricao': faker.paragraph(nb_sentences=10),\n", - " 'status': 'CONCLUIDO',\n", - " 'data_inicio': faker.past_date(start_date='-1y'),\n", - " 'data_estimada_fim': faker.future_date(),\n", - " 'data_fim_real': faker.future_date(),\n", - " 'icone_url': choice(icone_ciclo_urls)\n", - " })" + " qtd_ciclos = QTD_CICLOS_FIXOS if gestor['id_empresa'] in [1, 2, 3] else randint(QTD_CICLOS_MIN, QTD_CICLOS_MAX)\n", + "\n", + " for _ in range(qtd_ciclos):\n", + " status = choices(status_ciclo, weights=[25, 25, 25, 20, 3, 1, 1], k=1)[0]\n", + " dados_ciclo.append({\n", + " 'id_empresa': gestor['id_empresa'],\n", + " 'id_responsavel': gestor['id_usuario'],\n", + " 'id_ishikawa_mongo': uuid4(),\n", + " 'titulo': faker.sentence(nb_words=5),\n", + " 'descricao': faker.paragraph(nb_sentences=10),\n", + " 'status': status,\n", + " 'data_inicio': (data_inicio := data_aleatoria()),\n", + " 'data_estimada_fim': data_prazo(data_inicio),\n", + " 'data_fim_real': data_aleatoria(data_inicio) if status == 'CONCLUIDO' else None,\n", + " 'icone_url': choice(icone_ciclo_urls)\n", + " })" ] }, { @@ -325,6 +411,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.658350700Z", "start_time": "2026-07-12T17:38:16.649332Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:18.992219Z", + "iopub.status.busy": "2026-10-04T01:05:18.991826Z", + "iopub.status.idle": "2026-10-04T01:05:19.228697Z", + "shell.execute_reply": "2026-10-04T01:05:19.226464Z" } }, "outputs": [], @@ -354,7 +446,7 @@ " 'valor_base': randint(1000, 100000),\n", " 'valor_alvo': randint(1000, 100000),\n", " 'unidade': choice(['R$', 'US$', 'EUR']),\n", - " 'prazo': faker.future_date(),\n", + " 'prazo': data_prazo(),\n", " 'status': choice(['PARCIALMENTE_ATINGIDA', 'ATINGIDA', 'NAO_ATINGIDA']),\n", " 'prioridade': choice(['BAIXA', 'MEDIA', 'ALTA', 'CRITICA']),\n", " 'area': choice(areas),\n", @@ -372,6 +464,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.670638900Z", "start_time": "2026-07-12T17:38:16.660829800Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:19.232691Z", + "iopub.status.busy": "2026-10-04T01:05:19.232316Z", + "iopub.status.idle": "2026-10-04T01:05:20.444256Z", + "shell.execute_reply": "2026-10-04T01:05:20.442385Z" } }, "outputs": [], @@ -381,7 +479,7 @@ "id_problema = 1\n", "\n", "for id_ciclo, ciclo in enumerate(dados_ciclo, start=1):\n", - " qtd_problema = randint(1, 5)\n", + " qtd_problema = randint(QTD_PROBLEMAS_MIN, QTD_PROBLEMAS_MAX)\n", "\n", " for i in range(qtd_problema):\n", " dados_problema.append({\n", @@ -410,6 +508,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.685420900Z", "start_time": "2026-07-12T17:38:16.672640500Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:20.448337Z", + "iopub.status.busy": "2026-10-04T01:05:20.447908Z", + "iopub.status.idle": "2026-10-04T01:05:21.595022Z", + "shell.execute_reply": "2026-10-04T01:05:21.593544Z" } }, "outputs": [], @@ -440,6 +544,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.714712600Z", "start_time": "2026-07-12T17:38:16.699837500Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:21.599343Z", + "iopub.status.busy": "2026-10-04T01:05:21.598969Z", + "iopub.status.idle": "2026-10-04T01:05:21.736657Z", + "shell.execute_reply": "2026-10-04T01:05:21.734463Z" } }, "outputs": [], @@ -454,7 +564,7 @@ " 'what_acao': faker.sentence(nb_words=10),\n", " 'why_justificativa': faker.sentence(nb_words=10),\n", " 'where_local': faker.sentence(nb_words=10),\n", - " 'when_fim': faker.future_date(),\n", + " 'when_fim': data_prazo(),\n", " 'how_modo_execucao': faker.sentence(nb_words=10),\n", " 'how_much_custo': randint(1000, 100000),\n", " })" @@ -468,6 +578,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.727891900Z", "start_time": "2026-07-12T17:38:16.716743100Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:21.742534Z", + "iopub.status.busy": "2026-10-04T01:05:21.741964Z", + "iopub.status.idle": "2026-10-04T01:05:23.279618Z", + "shell.execute_reply": "2026-10-04T01:05:23.275083Z" } }, "outputs": [], @@ -476,15 +592,15 @@ "dados_tarefa = []\n", "\n", "for id_plano_acao, plano_acao in enumerate(dados_plano_acao, start=1):\n", - " for _ in range(randint(1, 10)):\n", + " for _ in range(randint(QTD_TAREFAS_MIN, QTD_TAREFAS_MAX)):\n", " dados_tarefa.append({\n", " 'id_plano_acao': id_plano_acao,\n", " 'id_responsavel': plano_acao['criado_por'],\n", " 'titulo': faker.sentence(nb_words=5),\n", " 'descricao': faker.sentence(nb_words=10),\n", " 'prioridade': choice(['BAIXA', 'MEDIA', 'ALTA', 'CRITICA']),\n", - " 'status': 'PENDENTE',\n", - " 'data_fim_prevista': faker.future_date()\n", + " 'status': choice(['PENDENTE', 'EM_ANDAMENTO', 'BLOQUEADA', 'CONCLUIDA', 'ATRASADA', 'CANCELADA']),\n", + " 'data_fim_prevista': data_prazo()\n", " })" ] }, @@ -496,6 +612,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.740852Z", "start_time": "2026-07-12T17:38:16.729201Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:23.289313Z", + "iopub.status.busy": "2026-10-04T01:05:23.288434Z", + "iopub.status.idle": "2026-10-04T01:05:23.467126Z", + "shell.execute_reply": "2026-10-04T01:05:23.462729Z" } }, "outputs": [], @@ -509,7 +631,7 @@ " 'id_responsavel': ciclo['id_responsavel'],\n", " 'titulo': faker.sentence(nb_words=5),\n", " 'descricao': faker.sentence(nb_words=10),\n", - " 'data_treinamento': faker.future_date(),\n", + " 'data_treinamento': data_prazo(),\n", " 'obrigatorio': choice([True, False])\n", " })" ] @@ -522,6 +644,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.752311500Z", "start_time": "2026-07-12T17:38:16.742923900Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:23.475900Z", + "iopub.status.busy": "2026-10-04T01:05:23.474617Z", + "iopub.status.idle": "2026-10-04T01:05:23.546659Z", + "shell.execute_reply": "2026-10-04T01:05:23.543074Z" } }, "outputs": [], @@ -547,6 +675,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.766388400Z", "start_time": "2026-07-12T17:38:16.755314200Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:23.552723Z", + "iopub.status.busy": "2026-10-04T01:05:23.552217Z", + "iopub.status.idle": "2026-10-04T01:05:24.404984Z", + "shell.execute_reply": "2026-10-04T01:05:24.402352Z" } }, "outputs": [], @@ -555,7 +689,7 @@ "dados_efeito_secundario = []\n", "\n", "for id_verificacao, verificacao in enumerate(dados_verificacao, start=1):\n", - " for _ in range(randint(1, 10)):\n", + " for _ in range(randint(QTD_EFEITOS_MIN, QTD_EFEITOS_MAX)):\n", " dados_efeito_secundario.append({\n", " 'id_verificacao_resultado': id_verificacao,\n", " 'descricao': faker.sentence(nb_words=10),\n", @@ -573,6 +707,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.790710700Z", "start_time": "2026-07-12T17:38:16.768392800Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:24.410746Z", + "iopub.status.busy": "2026-10-04T01:05:24.410246Z", + "iopub.status.idle": "2026-10-04T01:05:24.686446Z", + "shell.execute_reply": "2026-10-04T01:05:24.681567Z" } }, "outputs": [], @@ -606,6 +746,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.812063100Z", "start_time": "2026-07-12T17:38:16.792704900Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:24.691899Z", + "iopub.status.busy": "2026-10-04T01:05:24.691401Z", + "iopub.status.idle": "2026-10-04T01:05:33.933255Z", + "shell.execute_reply": "2026-10-04T01:05:33.929618Z" } }, "outputs": [], @@ -649,8 +795,8 @@ " 'id_treinamento': id_treinamento,\n", " 'id_usuario': id_usuario,\n", " 'obrigatorio': treinamento['obrigatorio'],\n", - " 'status': choice(['PENDENTE', 'CONFIRMADO', 'CONCLUIDO']),\n", - " 'terminado_em': faker.future_date()\n", + " 'status': (status_treinamento := choice(['PENDENTE', 'CONFIRMADO', 'CONCLUIDO'])),\n", + " 'terminado_em': data_aleatoria() if status_treinamento == 'CONCLUIDO' else None\n", " })\n", "\n", "for problema in dados_problema:\n", @@ -681,6 +827,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.841613600Z", "start_time": "2026-07-12T17:38:16.815060900Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:33.941881Z", + "iopub.status.busy": "2026-10-04T01:05:33.940899Z", + "iopub.status.idle": "2026-10-04T01:05:33.959240Z", + "shell.execute_reply": "2026-10-04T01:05:33.955165Z" } }, "outputs": [], @@ -719,6 +871,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:16.859731300Z", "start_time": "2026-07-12T17:38:16.843629600Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:33.967362Z", + "iopub.status.busy": "2026-10-04T01:05:33.966679Z", + "iopub.status.idle": "2026-10-04T01:05:33.979369Z", + "shell.execute_reply": "2026-10-04T01:05:33.975188Z" } }, "outputs": [], @@ -735,6 +893,12 @@ "ExecuteTime": { "end_time": "2026-07-12T17:38:17.163562400Z", "start_time": "2026-07-12T17:38:16.860730900Z" + }, + "execution": { + "iopub.execute_input": "2026-10-04T01:05:33.986875Z", + "iopub.status.busy": "2026-10-04T01:05:33.986123Z", + "iopub.status.idle": "2026-10-04T01:09:36.562149Z", + "shell.execute_reply": "2026-10-04T01:09:36.560084Z" } }, "outputs": [], @@ -746,7 +910,10 @@ " conn.execute(text(\"SET LOCAL app.current_user_id = '0'\"))\n", " dtype = None\n", " if (schema, tabela) == ('pdca', 'ciclo'):\n", - " dtype = {'id_ishikawa_mongo': UUID(as_uuid=True)}\n", + " dtype = {\n", + " 'id_ishikawa_mongo': UUID(as_uuid=True),\n", + " 'data_fim_real': Date()\n", + " }\n", " elif (schema, tabela) == ('pdca', 'causa_raiz'):\n", " dtype = {'id_5_porques_mongo': UUID(as_uuid=True)}\n", " df.to_sql(name = tabela, schema = schema, con = conn, if_exists = 'append', index = False, dtype = dtype)\n", @@ -758,7 +925,7 @@ " except Exception as e:\n", " print(f'Um erro no banco de dados ocorreu: {e}')\n", " raise\n", - "print('Conexão com o banco de dados finalizada com sucesso')\n" + "print('Conexão com o banco de dados finalizada com sucesso')" ] } ], diff --git a/sql/001_script.sql b/sql/001_script.sql index 36bfe8e..bdea6dc 100644 --- a/sql/001_script.sql +++ b/sql/001_script.sql @@ -238,6 +238,8 @@ CREATE TABLE IF NOT EXISTS pdca.plano_5w2h ( when_fim DATE NOT NULL, how_modo_execucao TEXT NOT NULL, how_much_custo NUMERIC(12,2) NOT NULL CHECK (how_much_custo >= 0), + colaboradores_podem_editar BOOLEAN NOT NULL DEFAULT FALSE, + id_ultima_alteracao_por BIGINT REFERENCES usuario_sistema(id), criado_em TIMESTAMPTZ NOT NULL DEFAULT NOW(), atualizado_em TIMESTAMPTZ, CONSTRAINT plano_5w2h_datas_check CHECK (when_inicio IS NULL OR when_fim >= when_inicio) diff --git a/sql/007_comments.sql b/sql/007_comments.sql index f4e1d64..83ad76e 100644 --- a/sql/007_comments.sql +++ b/sql/007_comments.sql @@ -198,6 +198,8 @@ COMMENT ON COLUMN pdca.plano_5w2h.when_inicio IS 'Data de inicio da acao.'; COMMENT ON COLUMN pdca.plano_5w2h.when_fim IS 'Data de fim planejada da acao.'; COMMENT ON COLUMN pdca.plano_5w2h.how_modo_execucao IS 'Como a acao sera executada.'; COMMENT ON COLUMN pdca.plano_5w2h.how_much_custo IS 'Custo estimado da acao.'; +COMMENT ON COLUMN pdca.plano_5w2h.colaboradores_podem_editar IS 'Indica se colaboradores do ciclo podem editar o 5W2H.'; +COMMENT ON COLUMN pdca.plano_5w2h.id_ultima_alteracao_por IS 'Usuario que realizou a ultima alteracao no 5W2H.'; COMMENT ON COLUMN pdca.plano_5w2h.criado_em IS 'Data e hora de criacao do registro.'; COMMENT ON COLUMN pdca.plano_5w2h.atualizado_em IS 'Data e hora da ultima atualizacao do registro.'; diff --git a/sql/008_catalogo.sql b/sql/008_catalogo.sql index 04410e8..7cee72a 100644 --- a/sql/008_catalogo.sql +++ b/sql/008_catalogo.sql @@ -205,6 +205,8 @@ INSERT INTO auditoria.catalogo_dados ( ('pdca', 'plano_5w2h', 'when_fim', 'DATE', FALSE, FALSE, NULL, TRUE, 'Data limite (When). Deve ser >= when_inicio se este for informado.', 'INTERNO', 'Data de fim planejada da ação.'), ('pdca', 'plano_5w2h', 'how_modo_execucao', 'TEXT', FALSE, FALSE, NULL, TRUE, 'Método (How).', 'INTERNO', 'Como a ação será executada.'), ('pdca', 'plano_5w2h', 'how_much_custo', 'NUMERIC(12,2)', FALSE, FALSE, NULL, TRUE, 'Custo monetário (How much). Deve ser >= 0.', 'SENSIVEL', 'Custo estimado da ação.'), +('pdca', 'plano_5w2h', 'colaboradores_podem_editar', 'BOOLEAN', FALSE, FALSE, NULL, TRUE, 'Valor padrão FALSE. Controla a edição por colaboradores do ciclo.', 'INTERNO', 'Indica se colaboradores do ciclo podem editar o 5W2H.'), +('pdca', 'plano_5w2h', 'id_ultima_alteracao_por', 'BIGINT', FALSE, TRUE, 'public.usuario_sistema(id)', FALSE, 'Usuário que realizou a última alteração no 5W2H.', 'INTERNO', 'Identifica o usuário responsável pela última alteração.'), ('pdca', 'plano_5w2h', 'criado_em', 'TIMESTAMPTZ', FALSE, FALSE, NULL, TRUE, 'Valor padrão NOW().', 'INTERNO', 'Data e hora de criação do registro.'), ('pdca', 'plano_5w2h', 'atualizado_em', 'TIMESTAMPTZ', FALSE, FALSE, NULL, FALSE, 'Data da última edição.', 'INTERNO', 'Data e hora da última atualização do registro.'),