vat_wms/init_config_db.sql
2025-05-13 12:32:55 +02:00

89 lines
3.1 KiB
SQL

create table stock_handling
(
id int not null auto_increment primary key,
physical_item_id int not null,
field_updated varchar(64) not null,
value_prev text not null,
value_new text not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_positions
(
id int not null auto_increment primary key,
line varchar(5) not null,
rack varchar(5) not null,
shelf varchar(5) not null,
position varchar(5) not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_batch (
id int not null primary key auto_increment,
supplier_id int unsigned not null,
user_id int not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_entry
(
id int not null auto_increment primary key,
physical_item_id int not null,
supplier_id int unsigned not null,
count int default 0 not null,
price double null,
bought date default null,
description text null,
note text null,
stock_position_id int not null,
country_of_origin_id int unsigned not null,
on_the_way bool not null default false,
stock_batch_id int default null,
created_at timestamp default current_timestamp() not null,
created_by tinyint unsigned default 1 not null,
updated_at timestamp default current_timestamp() not null on update current_timestamp(),
updated_by tinyint unsigned null
);
create table stock_attributes (
id int primary key auto_increment,
name varchar(64) not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_attributes_translation (
stock_attributes_id int not null,
language_id int not null,
translated_name varchar(128) not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_attribute_values (
id int primary key auto_increment,
stock_attribute_id int not null,
name varchar(64) not null,
language_id int not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);
create table stock_entry2attributes (
stock_attributes_id int not null,
stock_attribute_value_id int not null,
created_at DATETIME DEFAULT now(),
updated_at DATETIME DEFAULT NULL ON UPDATE now()
);