
create table if not exists seasons(
id integer not null,
name varchar(100) not null,
active integer not null default 1,
created_at varchar(100) not null
); 


create table province(
id integer not null,
names varchar(100) not null
);





create table if not exists users(

id integer not null,
name varchar(100) not null,
surname varchar(100) not null,
username varchar(100) not null,
hash varchar(100) not null,
rightsid integer not null,
active integer not null default 1,
access_code integer not null,
created_at varchar(100) not null

);



create table if not exists user_home(
id integer primary key autoIncrement,
userid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id)
);




create table if not exists products(
id integer primary key autoIncrement,
name varchar(100) not null,
units varchar(100) not null
);



create table if not exists prices(
id integer primary key autoIncrement,
userid integer not null,
productid integer not null,
amount double(100,2) not null default 0,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(productid) references products(id)
);


create table if not exists growers(
id integer primary key autoIncrement,
userid integer not null,
name varchar(100) not null,
surname varchar(100) not null,
grower_num varchar(100),
area varchar(100) not null,
province varchar(100),
phone varchar(100),
id_num varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100),
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_profile(
id integer primary key autoIncrement,
growerid integer not null,
image blob not null,
created_at varchar(100) not null
);


create table if not exists lat_long(
id integer primary key autoIncrement,
userid integer not null ,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
hectares varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists grower_farm(
id integer primary key autoIncrement,
userid integer not null ,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_visits(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
description varchar(100) not null,
conditions varchar(100) not null,
other varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists assessments(
id integer primary key autoIncrement,
userid integer not null,
name varchar(100) not null unique,
assessment_typeid integer not null default 1,
number integer not null default 1,
foreign key(userid) references users(id),
foreign key(assessment_typeid) references assessment_type(id)
);



create table if not exists quantitative_assessments(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
description varchar(100) not null,
number varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);







create table if not exists assessment_images(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
seasonid integer not null,
url varchar(100) not null,
image blob ,
description varchar(100) not null,
conditions varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists grower_image(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
seasonid integer not null,
image varchar(1000000) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);









create table if not exists sod(
id integer primary key autoIncrement,
userid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
time varchar(100) not null,
eod integer not null default 0 ,
sync integer not null default 0,
created_at varchar(100) not null,
eod_created_at TEXT not null unique,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);








create table if not exists road_blocks(
id integer primary key autoIncrement,
userid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
time varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists eod(
id integer primary key autoIncrement,
userid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
time varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists off_route(

id integer primary key autoIncrement,
userid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
time varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists last_eod_date(
id integer primary key autoIncrement,
created_at varchar(100) not null 
);



create table if not exists exemptions(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
exemption_date varchar(100) not null unique,
description varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists recovery(
id integer primary key autoIncrement,
grower_num varchar(100) not null,
seasonid integer not null,
userid integer not null,
bales integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists activation(
id integer primary key autoIncrement,
activation_key varchar(100) not null,
startDate varchar(100) not null,
endDate varchar(100) not null,
functions integer not null default 0,
created_at varchar(100) not null
);


create table if not exists seed_beds(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
no_of_irr_beds integer not null default 0,
no_of_dry_beds integer not null default 0,
buying_seedlings_for varchar(100),
varieties_irr varchar(100),
varieties_dry varchar(100),
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);


create table if not exists seedling_quality(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
excellent integer not null default 0,
standard integer not null default 0,
average integer not null default 0,
poor integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);


create table if not exists plant_irrigated(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
ha_planted_to_date varchar(100),
ha varchar(100),
date_of_plant varchar(100),
crop_stand_perc varchar(100),
crop_unifomity_perc varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);


create table if not exists planting_dryLand(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
ha_planted_to_date varchar(100),
ha varchar(100),
date_of_plant varchar(100),
crop_stand_perc varchar(100),
crop_unifomity_perc varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);


create table if not exists crop_growth(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
quarter_grown_5_7 integer not null default 0,
half_grown_8_12 integer not null default 0,
three_quarters_13_17 integer not null default 0,
full_grown_18_22 integer not null default 0,
fully_developed integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists crop_development(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
light_yellow integer default 0,
light_green integer default 0,
medium integer default 0,
heavy_and_dark integer default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);


create table if not exists cultural_practices(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
weed_infestation_level_perc varchar(100),
weed_control_method varchar(100),
topping_level varchar(100),
basal_plant_fertilisation_kg_ha varchar(100),
suckering integer not null default 0,
post_topping_unifomity_perc varchar(100),
pets_and_disease_management varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);




create table if not exists barn_repair_and_maintenance(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
barn_not_repaired integer not null default 0,
barn_under_repair integer not null default 0,
finished_repaired integer not null default 0,
barn_working_well integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);



create table if not exists ploughing(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
no_of_plants integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);




create table if not exists fertilization_ammonium(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
kg_per_ha varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);




create table if not exists fertilization_potassium(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
kg_per_ha varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);







create table if not exists reaping(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
top_leaf integer not null default 0,
lugs integer not null default 0,
cutters integer not null default 0,
prime integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);







create table if not exists curing(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
reap_decription varchar(100) not null,
yellowing integer not null default 0,
leaf_drying integer not null default 0,
stem_drying integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);





create table if not exists barn_location(
id integer primary key autoIncrement,
userid integer not null ,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists  farm_mapping(

id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
first_lat varchar(100) not null,
first_long varchar(100) not null,
second_lat varchar(100) not null,
second_long varchar(100) not null,
third_lat varchar(100) not null,
third_long varchar(100) not null,
forth_lat varchar(100) not null,
forth_long varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);


create table if not exists  mapped_hectares(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
ha varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists  mapped_hail_hectares(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
ha varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);




create table if not exists estimates(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
varieties varchar(100) not null,
estimate varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);







create table if not exists data_collection(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
grower_age integer not null,
grower_sex integer not null ,
number_of_works integer not null,
income_per_month double(100,2) not null,
number_of_kids integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);


create table if not exists kids_age(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
kid_age integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);




create table if not exists education_level(
id integer not null,
description varchar(100) not null
);


create table if not exists grower_level_of_education(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
education_level_id integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(education_level_id) references education_level(id),
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);



create table if not exists health_conditions(
id integer not null,
description varchar(100) not null
);



create table if not exists grower_health(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
health_conditionid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(health_conditionid) references health_conditions(id),
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);





create table if not exists  hail_strike_mapping(

id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
first_lat varchar(100) not null,
first_long varchar(100) not null,
second_lat varchar(100) not null,
second_long varchar(100) not null,
third_lat varchar(100) not null,
third_long varchar(100) not null,
forth_lat varchar(100) not null,
forth_long varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);



create table if not exists hail_strike(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
percentage_strike varchar(100) not null,
strike_date varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)

);





create table if not exists truck_destination_2(
id integer not null,
userid integer not null,
trucknumber varchar(100) not null,
driver_name varchar(100) not null,
driver_surname varchar(100) not null,
destination varchar(100) not null,
password varchar(100) not null,
distance double(100,4) not null,
username varchar(100) not null,
close_open integer not null default 0,
sync integer not null default 0,
created_at varchar(100) not null,
end_at varchar(100) not null,
foreign key(userid) references users(id)
);



create table if not exists truck_products(
id integer primary key autoIncrement,
disbursement_trucksid integer not null,
userid integer not null,
productid integer not null,
quantity double(100,4) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(productid) references products(id),
foreign key(disbursement_trucksid) references truck_destination(id)
);



create table if not exists disbursement(
id integer not null,
disbursement_trucksid integer not null,
userid integer not null,
productid integer not null,
storeid integer not null,
quantity integer not null,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(productid) references products(id),
foreign key(storeid) references store(id),
foreign key(disbursement_trucksid) references truck_destination(id)
);



create table  if not exists truck_to_grower(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
disbursement_trucksid integer not null,
productid integer not null,
quantity integer not null,
created_at varchar(100) not null,
datetime TIMESTAMP not null,
foreign key(userid) references users(id),
foreign key(productid) references products(id),
foreign key(disbursement_trucksid) references truck_destination(id),
foreign key(growerid) references growers(id)
);





create table if not exists loans_2_0(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
productid integer not null,
quantity integer not null,
receipt_number varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
hectares varchar(100),
android_captureid integer not null default 0,
disbursement_trucksid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(productid) references products(id),
foreign key(disbursement_trucksid) references truck_destination(id)
);


create table if not exists protocol(
id integer primary key autoIncrement ,
description varchar(100)  not null
);



create table if not exists reg_location(
id integer primary key autoIncrement,
userid integer not null ,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
hectares varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists distance(
id integer primary key autoIncrement,
userid integer not null ,
distance double(100,2) not null default 0,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_new_image(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists grower_farm_image(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists grower_signatures(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists grower_id_image(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists hours_worked(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
hours doubl(100,2) not null default 0,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists assign_bale_tags(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
bale_tag varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);


create table if not exists bale_collector(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
name varchar(100) not null,
surname varchar(100) not null,
id_num varchar(100) not null,
transporter_number varchar(100) not null,
number_plate varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);






create table if not exists bale_collector_delivery_note(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collectorid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
created_at varchar(100) not null,
open_close integer not null default 0,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(bale_collectorid) references bale_collector(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists collector_id_num(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collector_delivery_noteid integer not null,
image_location varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(bale_collector_delivery_noteid) references bale_collector_delivery_note(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists collector_signature(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collector_delivery_noteid integer not null,
image_location varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(bale_collector_delivery_noteid) references bale_collector_delivery_note(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists bales_collected(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collector_delivery_noteid integer not null,
growerid integer not null,
bale_tag varchar(100) not null,
latitude varchar(100) not nll,
longitude varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(bale_collector_delivery_noteid) references bale_collector_delivery_note(id),
foreign key(growerid) references growers(id)
);



create table if not exists grower_bale_signature(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collector_delivery_noteid integer not null,
growerid integer not null,
image_location varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(bale_collector_delivery_noteid) references bale_collector_delivery_note(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists field_officer_task(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
task_url varchar(100) not null,
description varchar(100) not null,
duration_days integer not null,
task_min_growers integer not null default 20,
created_at varchar(100) not null,
end_at varchar(100) not null,
active integer not null default 1,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists task_viewer(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
task_url varchar(100) not null,
duration_days integer not null,
created_by_id integer not null,
task_min_growers integer not null default 20,
created_at varchar(100) not null,
active integer not null default 1,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(created_by_id) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists task_grower_data(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
task_url varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
created_at varchar(100) not null,
time_created varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists bales_collected_total(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bale_collector_delivery_noteid integer not null,
growerid integer not null,
tags_total integer not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(bale_collector_delivery_noteid) references bale_collector_delivery_note(id),
foreign key(growerid) references growers(id)
);



create table if not exists received_bales(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
bale_tag varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);

create table if not exists live_location_userid(
id integer primary key autoIncrement,
userid integer not null,
firebaseid varchar(200) not null,
active integer not null default 1,
created_at varchar(100) not null,
foreign key(userid) references users(id)
);





create table if not exists grower_captured_loans(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
seasonid integer not null,
productid integer not null,
receipt_number varchar(200) not null,
quantity integer not null,
verified integer not null,
created_at varchar(100) not null,
foreign key(userid) references users(id)
);


create table if not exists scheme(
id integer primary key autoIncrement,
userid integer not null,
description varchar(100) not null unique,
foreign key(userid) references users(id)
);




create table if not exists scheme_hectares(
id integer primary key autoIncrement,
userid integer not null,
schemeid integer not null,
seasonid integer not null,
quantity varchar(100) not null,
foreign key(userid) references users(id),
foreign key(schemeid) references scheme(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists scheme_hectares_products(
id integer primary key autoIncrement,
userid integer not null,
scheme_hectaresid integer not null,
productid integer not null,
quantity varchar(100) not null,
foreign key(userid) references users(id),
foreign key(scheme_hectaresid) references scheme_hectares(id),
foreign key(productid) references products(id)
);


create table if not exists scheme_hectares_growers(
id integer primary key autoIncrement,
userid integer not null,
scheme_hectaresid integer not null,
growerid integer not null,
foreign key(userid) references users(id),
foreign key(scheme_hectaresid) references scheme_hectares(id),
foreign key(growerid) references growers(id)
);





create table if not exists growers_otp (
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  growerid integer not null,
  used integer not null default 0,
  sent integer not null default 0,
  sync integer not null default 0,
  otp varchar(255) NOT NULL unique,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id),
  foreign key(growerid) references growers(id)
);



create table if not exists updated_grower_phone(
  id integer primary key autoIncrement,
  userid integer not null,
  growerid integer not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(growerid) references growers(id)
);




create table if not exists otp_to_product(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  growerid integer not null,
  productid integer not null,
  quantity integer not null,
  otp varchar(255) NOT NULL unique,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(growerid) references growers(id)
);




create table if not exists battery_level_report(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  battery_level varchar(255) NOT NULL,
  created_at varchar(100) not null,
  time varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id)
);



create table if not exists start_battery_level(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  battery_level varchar(255) NOT NULL,
  time varchar(100) not null,
  created_at varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id)
);









create table if not exists end_battery_level(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  battery_level varchar(255) NOT NULL,
  time varchar(100) not null,
  created_at varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id)
);










create table if not exists leave_form(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  leave_type varchar(100) not null,
  description varchar(255) not null,
  days integer not null default 1,
  state integer not null default 0,
  leave_date varchar(100) not null,
  created_at varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id)
);




create table if not exists grower_finger_print(
  id integer primary key autoIncrement,
  userid integer not null,
  seasonid integer not null,
  growerid integer not null,
  pin text not null,
  feature text not null,
  created_at varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id),
  foreign key(growerid) references growers(id)

);




create table if not exists grower_bale_booking(
  id integer primary key autoIncrement,
  userid integer not null,
  booking_username varchar(100) not null,
  seasonid integer not null,
  growerid integer not null,
  bales integer not null,
  booking_date varchar(100) not null,
  created_time varchar(100) not null,
  created_at varchar(100) not null,
  sync integer not null default 0,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id),
  foreign key(growerid) references growers(id)
);





create table if not exists grower_visit_schedule(
  id integer primary key autoIncrement,
  userid integer not null,
  growerid integer not null,
  seasonid integer not null,
  sync integer not null default 0,
  created_at varchar(100) not null,
  end_at varchar(100) not null,
  foreign key(userid) references users(id),
  foreign key(seasonid) references seasons(id),
  foreign key(growerid) references growers(id)
);


create table if not exists grower_groups(
id integer primary key autoIncrement,
description varchar(100) not null
);





create table if not exists grower_field_officer_groups(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
field_officerid integer not null,
grower_groupid integer not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(field_officerid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id),
foreign key(grower_groupid) references grower_groups(id)
);



create table if not exists seedbed_location(
id integer primary key autoIncrement,
userid integer not null ,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)



create table if not exists home_location_update(
id integer primary key autoIncrement,
growerid integer not null,
seasonid integer not null,
sync integer not null default 0,
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists barn_location_update(
id integer primary key autoIncrement,
growerid integer not null,
seasonid integer not null,
sync integer not null default 0,
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists farm_location_update(
id integer primary key autoIncrement,
growerid integer not null,
seasonid integer not null,
sync integer not null default 0,
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists seedbed_location_update(
id integer primary key autoIncrement,
growerid integer not null,
seasonid integer not null,
sync integer not null default 0,
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists grower_training(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
number_of_growers integer not null,
system_count_growers integer not null,
description varchar(100) not null,
image varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists bike_assessments(
id integer primary key autoIncrement,
userid integer not null,
start_end_day integer not null,
seasonid integer not null,
bike_part varchar(100) not null,
description varchar(100) not null,
image varchar(100) not null,
time varchar(100) not null,
created_at varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists visits(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
seasonid integer not null,
description varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);


create table if not exists daily_fieldofficer_report(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
username varchar(100) not null,
numberOfVisits integer not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists daily_saved_visits(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
username varchar(100) not null,
grower_num varchar(100) not null,
description varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists field_officer_daily_encrypted(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
username varchar(100) not null,
description varchar(300) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists questionnaires(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
question varchar(100) not null,
type varchar(100) not null,
access_point varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists questionnaires_answers_general(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
question varchar(100) not null,
answer varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
question_created_at varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists questionnaires_answers_by_grower(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
question varchar(100) not null,
answer varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
question_created_at varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);






create table if not exists weekly_plan(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
system_generated_weekly_visits integer not null,
weekly_visits integer not null,
daily_visits integer not null,
no_of_visits_per_grower integer not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists gift_card(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
total_visits integer not null default 0,
visits_per_day integer not null default 0,
growers_to_visit integer not null default 0,
reward_percentage double(100,2) not null default 0,
reward varchar(100) not null,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists weekly_points_earned(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
points integer not null default 0,
target_points integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists monthly_payroll_dates(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
month varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);

create table if not exists time_based_task(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
weekly_planid integer not null,
start_time varchar(100) not null,
end_time varchar(100) not null,
task_hours integer not null,
target_growers integer not null default 0,
created_at varchar(100) not null,
end_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(weekly_planid) references weekly_plan(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists salary_variables(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
salary double(200,4) not null default 0,
hectares double(200,4) not null default 0,
daily_reports double(200,4) not null default 0,
grower_visits double(200,4) not null default 0,
system_based_tasks double(200,4) not null default 0,
bike_maintenance double(200,4) not null default 0,
ctl_related double(200,4) not null default 0,
training_and_demo double(200,4) not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists monthly_salary_variables(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
month varchar(100) not null,
salary double(200,4) not null default 0,
hectares double(200,4) not null default 0,
daily_reports double(200,4) not null default 0,
grower_visits double(200,4) not null default 0,
system_based_tasks double(200,4) not null default 0,
bike_maintenance double(200,4) not null default 0,
ctl_related double(200,4) not null default 0,
training_and_demo double(200,4) not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists questionnaire_bale_answers_by_grower(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
question varchar(100) not null,
bales integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
question_created_at varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists questionnaire_image(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
question varchar(100) not null,
answer varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
image_location varchar(100) not null,
sync integer not null default 0,
question_created_at varchar(100) not null,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists training_grower_attendance_list(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists bike_maintenance(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
bike_part varchar(100) not null,
part_state varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists bike_image(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists ctl_related_end_date(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
end_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists ctl_related_growers(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
created_at varchar(100) not null,
end_at varchar(100) not null,
sync integer not null default 0,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists floor_dispatched_bales(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
barcode varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists warehousing_storage_received_bales(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
barcode varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists verify_sold_bales(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
barcode varchar(100) not null,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists bale_verification_mass(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
barcode varchar(100) not null,
mass double(100,4) not null default 0,
description varchar(100) not null ,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists live_location_data(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null ,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists resting_point(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null ,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists zero_bale_comment(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
comment varchar(100) not null,
next_sale_date varchar(100) not null ,
question varchar(100) not null,
question_date varchar(100) not null ,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);




create table if not exists loans_3_0(
id integer primary key autoIncrement,
userid integer not null,
growerid integer not null,
productid integer not null,
quantity double not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
hectares varchar(100) not null,
android_captureid integer not null default 0,
comment varchar(100) not null,
adjustment_quantity double not null,
adjust integer not null default 0,
sync integer not null default 0,
surrogate integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(productid) references products(id)
);




create table if not exists disbursed_products_grower_truck(
id integer primary key autoIncrement,
userid integer not null,
disbursement_trucksid integer not null,
growerid integer not null,
productid integer not null,
quantity double not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
seasonid integer not null,
comment varchar(100) not null,
adjustment_quantity double not null,
adjust integer not null default 0,
sync integer not null default 0,
surrogate integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(productid) references products(id),
foreign key(disbursement_trucksid) references truck_destination_2(id)
);


create table if not exists file_manager(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
location_url varchar(200) not null,
description varchar(100) not null,
file_type varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists daily_movements(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
latitude varchar(200) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists target_monthly_hectare_visits(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
min_hectares double(100,4) not null,
max_hectares double(100,4) not null,
created_at varchar(100) not null,
expire_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_scheme_signature(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
image_location varchar(100) not null,
hectares varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_disbursement_signature(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
disbursement_trucksid integer not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(disbursement_trucksid) references truck_destination_2(id)
);


create table if not exists wrong_grower_capture_position(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
distance double(100,4) not null,
accuracy double(100,4) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);






create table if not exists count_end_of_days(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists grower_assessment_confirmation(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);





create table if not exists disburse_products_by_date(
id integer primary key autoIncrement,
userid integer not null,
productid integer not null,
seasonid integer not null,
created_at varchar(100) not null,
start_date varchar(100) not null,
end_date varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(productid) references products(id)
);



create table if not exists grower_verification_id_data(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
description varchar(200) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetime varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists truck_grower_qrcode_disbursed_mobile(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
disbursement_trucksid integer not null,
growerid integer not null,
receipt_num varchar(100) not null,
hectares varchar(100) not null,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(disbursement_trucksid) references truck_destination_2(id)
);



create table if not exists field_officer_signature(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
image_location varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists assessment_comment_and_hectares(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
description varchar(100) not null,
comment varchar(100) not null,
hectares varchar(100) not null ,
created_at varchar(100) not null,
datetimes varchar(100) not null,
sync integer not null default 0,
foreign key(userid) references users(id),
foreign key(seasonid) references seasons(id),
foreign key(growerid) references growers(id)
);



create table if not exists disbursement_finger_print_verification_and_approval(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
disbursement_trucksid integer not null,
username varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(disbursement_trucksid) references truck_destination_2(id)
);






create table if not exists verification_users(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
username varchar(100) not null,
active integer not null default 1,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists images_collected_for_approval(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
disbursement_trucksid integer not null,
description varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id),
foreign key(disbursement_trucksid) references truck_destination_2(id)
);







create table if not exists germination(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
plant_date varchar(100) not null,
hectares varchar(100) not null,
bed_type varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
variety varchar(100) not null,
germination_percentage varchar(100) not null,
pocket_num varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists cultural_practises_weeding(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
description varchar(100) not null,
weeding_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists cultural_practises_topping(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
description varchar(100) not null,
topping_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists chemical_application_fungicides(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
chemical varchar(100) not null,
chemical_application_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);





create table if not exists chemical_application_pesticides(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
chemical varchar(100) not null,
chemical_application_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists chemical_application_herbicides(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
chemical varchar(100) not null,
chemical_application_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists disease_monitoring(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
pest_disease_description varchar(100) not null,
chemical varchar(100) not null,
chemical_application_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


create table if not exists pest_monitoring(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
pest_disease_description varchar(100) not null,
chemical varchar(100) not null,
chemical_application_date varchar(100) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);




create table if not exists soil_health_drainage(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
description varchar(100) not null,
percentage double(100,4) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);



create table if not exists soil_health_structure(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
description varchar(100) not null,
percentage double(100,4) not null,
latitude varchar(100) not null,
longitude varchar(100) not null,
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);






create table if not exists growth_vigour(
id integer primary key autoIncrement,
userid integer not null,
seasonid integer not null,
growerid integer not null,
seedling_state varchar(100) not null,
seedling_percentage double(100,4) not null,
growth_stage varchar(100) not null,
growth_stage_date varchar(100) not null,
latitude varchar(100),
longitude varchar(100),
sync integer not null default 0,
created_at varchar(100) not null,
datetimes varchar(100) not null,
foreign key(userid) references users(id),
foreign key(growerid) references growers(id),
foreign key(seasonid) references seasons(id)
);


public static final String TABLE_GROWTH_VIGOUR="growth_vigour";



public static final String TABLE_SOIL_HEALTH_STRUCTURE="soil_health_structure";
public static final String TABLE_SOIL_HEALTH_DRAINAGE="soil_health_drainage";



public static final String TABLE_PEST_MONITORING="pest_monitoring"
public static final String TABLE_DISEASE_MONITORING="disease_monitoring"
public static final String TABLE_GERMINATION="germination"
public static final String TABLE_CULTURAL_PRACTICES_WEEDING="cultural_practises_weeding";
public static final String TABLE_CULTURAL_PRACTICES_TOPPING="cultural_practises_topping";
public static final String TABLE_CHEMICAL_APPLICATION_FUNGICIDES="chemical_application_fungicides";
public static final String TABLE_CHEMICAL_APPLICATION_PESTICIDES="chemical_application_pesticides";
public static final String TABLE_CHEMICAL_APPLICATION_HERBICIDES="chemical_application_herbicides";

public static final String TABLE_COLLECTED_FOR_APPROVAL="images_collected_for_approval";

public static final String TABLE_VERIFICATION_USERS="verification_users";


public static final String TABLE_DISBURSEMENT_FINGER_PRINT_VERIFICATION_AND_APPROVAL="disbursement_finger_print_verification_and_approval";


public static final String TABLE_ASSESSMENT_COMMENT_AND_HECTARES="assessment_comment_and_hectares";

public static final String TABLE_FIELD_OFFICER_SIGNATURE="field_officer_signature";

public static final String TABLE_GROWER_QRCODE_DISBURSED_MOBILE="truck_grower_qrcode_disbursed_mobile";

public static final String TABLE_GROWER_VERIFICATION_ID_DATA="grower_verification_id_data";

public static final String TABLE_DISBURSE_PRODUCTS_BY_DATE="disburse_products_by_date";

public static final String TABLE_GROWER_ASSESSMENT_CONFIRMATION="grower_assessment_confirmation";

public static final String TABLE_COUNT_END_OF_DAYS="count_end_of_days";


public static final String TABLE_WRONG_GROWER_CAPTURE_POSITION="wrong_grower_capture_position";

public static final String TABLE_GROWER_SCHEME_SIGNATURE="grower_scheme_signature";

public static final String TABLE_GROWER_DISBURSEMENT_SIGNATURE="grower_disbursement_signature";

public static final String TABLE_TARGET_MONTHLY_HECTARE_VISITS="target_monthly_hectare_visits";


public static final String TABLE_FILE_MANAGER="file_manager";
public static final String TABLE_DAILY_MOVEMENT="daily_movements";

public static final String TABLE_DISBURSED_PRODUCTS_GROWER_TRUCK="disbursed_products_grower_truck";
public static final String TABLE_DESTINATION="truck_destination";
public static final String TABLE_TRUCK_PRODUCTS="truck_products";
public static final String TABLE_ZERO_BALE_COMMENT="zero_bale_comment";

public static final String TABLE_RESTING_POINT="resting_point";

public static final String TABLE_VERIFICATION_MASS="bale_verification_mass";

public static final String TABLE_VERIFY_SOLD_BALES="verify_sold_bales";

public static final String TABLE_FLOOR_DISPATCHED_BALES="floor_dispatched_bales";

public static final String TABLE_WAREHOUSING_STORAGE_RECEIVED_BALES="warehousing_storage_received_bales";

public static final String TABLE_CTL_RELATED_GROWERS="ctl_related_growers";

public static final String TABLE_CTL_RELATED_END_DATE="ctl_related_end_date";

public static final String TABLE_BIKE_MAINTENANCE="bike_maintenance";

public static final String TABLE_BIKE_IMAGE="bike_image";

public static final String TABLE_QUESTIONNAIRE_IMAGE="questionnaire_image";

public static final String TABLE_QUESTIONNAIRES_BALES_ANSWERS_BY_GROWER="questionnaires_bales_answers_by_grower";

public static final String TABLE_MONTHLY_SALARY_VARIABLES="monthly_salary_variables";

public static final String TABLE_SALARY_VARIABLES="salary_variables";

public static final String TABLE_WEEKLY_POINTS_EARNED="weekly_points_earned";

public static final String TABLE_GIFT_CARD="gift_card";

public static final String TABLE_WEEKLY_PLAN="weekly_plan";

public static final String TABLE_QUESTIONNAIRES="questionnaires";

public static final String TABLE_QUESTIONNAIRES_ANSWERS_GENERAL="questionnaires_answers_general";

public static final String TABLE_QUESTIONNAIRES_ANSWERS_BY_GROWER="questionnaires_answers_by_grower";

public static final String TABLE_DAILY_FIELD_OFFICER_REPORT="daily_fieldofficer_report";

public static final String DAILY_SAVED_VISITS="daily_saved_visits";

public static final String TABLE_GROWER_BIKE_ASSESSMENTS="bike_assessments";

public static final String TABLE_GROWER_VISITS="visits";

public static final String TABLE_GROWER_TRAINING="grower_training";

public static final String TABLE_HOME_LOCATION_UPDATE="home_location_update";

public static final String TABLE_BARN_LOCATION_UPDATE="barn_location_update";

public static final String TABLE_FARM_LOCATION_UPDATE="farm_location_update";

public static final String TABLE_SEEDBED_LOCATION_UPDATE="seedbed_location_update";

public static final String TABLE_GROWER_GROUPS="grower_groups";

public static final String TABLE_GROWER_FIELD_OFFICER_GROUPS="grower_field_officer_groups";

public static final String TABLE_GROWER_VISIT_SCHEDULE="grower_visit_schedule";

public static final String TABLE_GROWER_BALE_BOOKING="grower_bale_booking";

public static final String TABLE_BALES_COLLECTED="bales_collected";
public static final String TABLE_GROWER_BALE_SIGNATURE="grower_bale_signature";
public static final String TABLE_COLLECTOR_SIGNATURE="collector_signature";
public static final String TABLE_COLLECTOR_ID_NUM="collector_id_num";
public static final String TABLE_BALE_COLLECTOR_DELIVERY_NOTE="bale_collector_delivery_note";
public static final String TABLE_BALE_COLLECTOR="bale_collector";
public static final String TABLE_BALES_COLLECTED_TOTAL="bales_collected_total";
public static final String TABLE_ASSIGN_BALE_TAGS="assign_bale_tags";
public static final String TABLE_TASK_GROWER_DATA="task_grower_data";

public static final String TABLE_RECEIVED_BALES="received_bales";
public static final String TABLE_GROWER_CAPTURED_LOANS="grower_captured_loans";

public static final String TABLE_GROWER_OTP="growers_otp";

public static final String TABLE_UPDATE_GROWER_PHONE="updated_grower_phone";


public static final String TABLE_START_BATTERY_LEVEL="start_battery_level";

public static final String TABLE_END_BATTERY_LEVEL="end_battery_level";

public static final String TABLE_BATTERY_LEVEL_REPORT="battery_level_report";


public static final String TABLE_LEAVE_FORM="leave_form";

public static final String TABLE_GROWER_FINGER_PRINT="grower_finger_print";

