# 缴税人表主键自增
alter table hrsa_tax_agent modify id bigint auto_increment;
alter table hrsa_tax_rate_base modify id bigint auto_increment;
alter table hrsa_tax_rate_detail modify id bigint auto_increment;
alter table hrsa_add_up_deduction modify id bigint auto_increment;
alter table hrsa_add_up_situation modify id bigint auto_increment;
alter table hrsa_other_deduction modify id bigint auto_increment;
alter table hrsa_attend_quote_field modify id bigint auto_increment;
alter table hrsa_attend_quote_sync_set modify id bigint auto_increment;
# alter table hrsa_attend_quote_data modify id bigint auto_increment;
alter table hrsa_attend_quote_data_value modify id bigint auto_increment;

alter table hrsa_salary_item modify id bigint auto_increment;
alter table hrsa_salary_sob modify id bigint auto_increment;
alter table hrsa_salary_sob_range modify id bigint auto_increment;
alter table hrsa_salary_sob_item_group modify id bigint auto_increment;
alter table hrsa_salary_sob_emp_field modify id bigint auto_increment;
alter table hrsa_salary_sob_adjust_rule modify id bigint auto_increment;
alter table hrsa_salary_sob_check_rule modify id bigint auto_increment;
alter table hrsa_salary_archive_dimission modify id bigint auto_increment;
alter table hrsa_salary_archive modify id bigint auto_increment;
alter table hrsa_salary_archive_tax_agent modify id bigint auto_increment;
alter table hrsa_salary_archive_item modify id bigint auto_increment;
alter table hrsa_salary_acct_record modify id bigint auto_increment;
alter table hrsa_salary_acct_emp modify id bigint auto_increment;
alter table hrsa_acct_result_temp modify id bigint auto_increment;
alter table hrsa_formula modify id bigint auto_increment;
alter table hrsa_formula_var modify id bigint auto_increment;
alter table hrsa_salary_acct_result modify id bigint auto_increment;
alter table hrsa_excel_acct_result modify id bigint auto_increment;


# 福利方案主键自增增加
alter table hrsa_social_security_scheme modify id bigint auto_increment;
alter table hrsa_scheme_detail modify id bigint auto_increment;
alter table hrsa_insurance_category modify id bigint auto_increment;


# 福利档案
alter table hrsa_social_archives modify id bigint auto_increment;
alter table hrsa_fund_archives modify id bigint auto_increment;
alter table hrsa_other_archives modify id bigint auto_increment;


# 福利台账
alter table hrsa_bill_batch modify id bigint auto_increment;
alter table hrsa_bill_detail modify id bigint auto_increment;
alter table hrsa_bill_detail_temp modify id bigint auto_increment;
alter table hrsa_bill_inspect modify id bigint auto_increment;


ALTER TABLE hrsa_salary_item
ADD COLUMN data_type varchar(20) NOT NULL COMMENT '字段类型。string：字符、number：数字' AFTER tenant_key;

ALTER TABLE hrsa_sys_salary_item
ADD COLUMN data_type varchar(20) NOT NULL COMMENT '字段类型。string：字符、number：数字' AFTER tenant_key;


ALTER TABLE hrsa_salary_sob_default_item
ADD COLUMN sob_default_item_group_id bigint(0) NOT NULL COMMENT '薪资账套默认薪资项目分类的id' AFTER tenant_key,
ADD COLUMN sorted_index int(0) NOT NULL COMMENT '显示顺序' AFTER sob_default_item_group_id;


#  工资单发放
alter table hrsa_salary_template modify id bigint auto_increment;
ALTER TABLE hrsa_salary_template MODIFY background varchar (2000);


#  公式
CREATE TABLE hrsa_formula
(
    id               bigint        NOT NULL AUTO_INCREMENT,
    name             varchar(255)  NOT NULL COMMENT '名称',
    description      varchar(255)                                            DEFAULT NULL COMMENT '备注',
    module           varchar(255)  NOT NULL COMMENT '模块',
    use_for          varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用途',
    reference_type   varchar(255)                                            DEFAULT NULL COMMENT '引用类型',
    return_type      varchar(255)  NOT NULL COMMENT '返回类型',
    validate_type    varchar(255)  NOT NULL COMMENT '校验类型',
    extend_param     varchar(255)                                            DEFAULT NULL COMMENT '扩展参数',
    formula          varchar(4000) NOT NULL COMMENT '公式内容',
    formulaRunScript varchar(4000) NOT NULL COMMENT '公式脚本',
    creator          bigint        NOT NULL COMMENT '创建人',
    delete_type      int           NOT NULL COMMENT '是否删除0否1是',
    create_time      datetime      NOT NULL COMMENT '创建时间',
    update_time      datetime      NOT NULL COMMENT '删除时间',
    PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb3;

CREATE TABLE hrsa_formula_var
(
    id          bigint                                                  NOT NULL AUTO_INCREMENT,
    name        varchar(255)                                            NOT NULL COMMENT '名称',
    formula_id  bigint                                                  NOT NULL COMMENT '公式id',
    field_id    varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段id',
    field_name  varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名称',
    field_type  varchar(255)                                            NOT NULL COMMENT '字段类型，number,string',
    source      varchar(255)                                            NOT NULL COMMENT '来源',
    order_index int                                                     NOT NULL COMMENT '排序',
    creator     bigint                                                  NOT NULL COMMENT '创建人',
    delete_type int                                                     NOT NULL COMMENT '是否删除,0否1是',
    create_time datetime                                                NOT NULL COMMENT '创建时间',
    update_time datetime                                                NOT NULL COMMENT '删除时间',
    PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb3;


ALTER TABLE hrsa_salary_archive MODIFY COLUMN id bigint(0) NOT NULL FIRST;