generated from alkemyTech/base-ong-server-java
-
Notifications
You must be signed in to change notification settings - Fork 0
SQL
OsvaldoGWP edited this page Nov 29, 2021
·
4 revisions
- para los varchar colocar length
- nombre de tablas en singular a menos q sea una palabra reservada
- Convención de nomenclatura de campos de tabla de base de datos -> Ver
created_date timestamptz(0) NOT NULL DEFAULT NOW(),
created_by varchar(100) NULL,
modified_date timestamptz(0) NULL,
modified_by varchar(100) NULL,
deleted bool NOT NULL DEFAULT FALSE,
V0.1__user.sql
create table member (
-- Fields
id int8 NOT NULL GENERATED ALWAYS AS IDENTITY,
name VARCHAR(100) NOT NULL,
facebook_url VARCHAR(500) NULL,
instagram_url VARCHAR(500) NULL,
linkedin_url VARCHAR(500) NULL,
image VARCHAR(255) NOT NULL,
description VARCHAR(255) NULL,
-- Timestamps
created_date timestamptz(0) NOT NULL DEFAULT NOW(),
created_by varchar(100) NULL,
modified_date timestamptz(0) NULL,
modified_by varchar(100) NULL,
-- SoftDelete
deleted bool NOT NULL DEFAULT FALSE,
CONSTRAINT member_pk PRIMARY KEY (id)
);
NOTA: el campo id de una tabla se podria llamar id (asi solo) o id_nombre_dela_tabla, pero por convencion del equipo vamos por id (solo id)