Planificacion y avances de backend
This commit is contained in:
Binary file not shown.
@@ -1,38 +1,44 @@
|
||||
create table restaurantes (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table categorias (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table zonas_produccion (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table usuarios (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
auth0_id text not null,
|
||||
nombre text not null
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
auth0_id text not null,
|
||||
nombre text not null,
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table usuarios_restaurantes (
|
||||
usuario_id uuid references usuarios,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz,
|
||||
primary key (usuario_id, restaurante_id)
|
||||
);
|
||||
|
||||
@@ -40,29 +46,33 @@ create table productores (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
usuario_id uuid references usuarios,
|
||||
zona_produccion_id uuid references zonas_produccion,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table recaudadores (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
usuario_id uuid references usuarios,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table meseros (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
usuario_id uuid references usuarios,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table administradores (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
usuario_id uuid references usuarios,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table ingredientes (
|
||||
@@ -70,8 +80,9 @@ create table ingredientes (
|
||||
nombre text not null,
|
||||
medida text not null,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table productos (
|
||||
@@ -81,16 +92,18 @@ create table productos (
|
||||
categoria_id uuid references categorias,
|
||||
zona_produccion_id uuid references zonas_produccion,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table recetas (
|
||||
producto_id uuid references productos,
|
||||
ingrediente_id uuid references ingredientes,
|
||||
unidades numeric not null,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz,
|
||||
primary key (producto_id, ingrediente_id)
|
||||
);
|
||||
|
||||
@@ -102,8 +115,9 @@ create table proveedores (
|
||||
direccion text null,
|
||||
telefono text null,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table compras (
|
||||
@@ -111,8 +125,9 @@ create table compras (
|
||||
fecha_compra date not null,
|
||||
proveedor_id uuid references proveedores,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table facturas (
|
||||
@@ -125,8 +140,9 @@ create table facturas (
|
||||
fecha_emision date not null,
|
||||
fecha_vencimiento date not null,
|
||||
compra_id uuid references compras,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table compra_ingredientes (
|
||||
@@ -136,23 +152,26 @@ create table compra_ingredientes (
|
||||
monto_unitario_neto bigint not null,
|
||||
compra_id uuid references compras,
|
||||
ingrediente_id uuid references ingredientes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table sectores (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table tipos_canal (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table canales_venta (
|
||||
@@ -161,8 +180,9 @@ create table canales_venta (
|
||||
sector_id uuid references sectores,
|
||||
tipo_canal_id uuid references tipos_canal,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table ventas (
|
||||
@@ -171,8 +191,9 @@ create table ventas (
|
||||
mesero_id uuid references meseros,
|
||||
canal_id uuid references canales_venta,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table boletas_electronicas (
|
||||
@@ -180,23 +201,26 @@ create table boletas_electronicas (
|
||||
numero_boleta text not null,
|
||||
venta_id uuid references ventas,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table boletas_exentas (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
venta_id uuid references ventas,
|
||||
restaurante_id uuid references restaurantes,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table estados_produccion (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
nombre text not null,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
create table venta_productos (
|
||||
@@ -206,8 +230,9 @@ create table venta_productos (
|
||||
venta_id uuid references ventas,
|
||||
producto_id uuid references productos,
|
||||
estado_id uuid references estados_produccion,
|
||||
inserted_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp
|
||||
created_at timestamptz not null default current_timestamp,
|
||||
updated_at timestamptz not null default current_timestamp,
|
||||
deleted_at timestamptz
|
||||
);
|
||||
|
||||
------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user