Laravel migrations table structure in alpha order /***** ALTER TABLES AFTER CREATION - NOT A TABLE, JUST STRUCTURE UPDATES *****/ public function up() { $statementPeople = "ALTER TABLE people AUTO_INCREMENT = 1475;"; DB::unprepared($statementPeople); $statementOrg = "ALTER TABLE organizations AUTO_INCREMENT = 2000;"; DB::unprepared($statementOrg); $statementMeters = "ALTER TABLE meters AUTO_INCREMENT = 15000000;"; DB::unprepared($statementMeters); //current max = 12860936 /*$statementMachineStatus = "ALTER TABLE y2019_machine_status ADD INDEX idx_serNum_date (serial_number, date_timestamp)"; DB::unprepared($statementMachineStatus);*/ } /*********** ADDRESSES ***********/ public function up() { Schema::create('addresses', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->char('address_type', 1) ->comment = 'Type of address M=Main, L=Legal, B=Both'; $table->char('owner_type', 1) ->comment = 'The owner of the address can be an org, person, or building O=Org, P=Person, B=Building, U=User'; $table->integer('owner_id') ->comment = 'The id of the org or the id of the person to whom the address belongs.'; $table->string('address', 50); //$table->string('address2', 50)->nullable(); //$table->string('po_box', 25)->nullable(); $table->string('city', 50)->nullable(); $table->string('state', 2)->nullable(); $table->string('zip_code', 10)->nullable(); $table->string('county', 25)->nullable(); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** BUILDINGS ***********/ public function up() { Schema::create('buildings', function (Blueprint $table) { // $table->id(); $table->bigIncrements('id'); $table->integer('organizations_id'); $table->string('bldg_name', 40); $table->string('bldg_name_short', 25)->nullable() ->comment('This is for use in graphs so the name will fit.'); $table->integer('bldg_contact_id')->nullable() ->comment('Building contact person link to contact table id.'); $table->integer('tech_contact_id')->nullable() ->comment('IT contact person link to contact table id.'); $table->integer('meter_contact_id')->nullable() ->comment('Meter reader contact person link to contact table id.'); $table->integer('student_pop')->nullable() ->comment('The student population for this building.'); $table->decimal('bldg_equip_cost', 11, 2)->nullable() ->comment('A field where Pam manually enters data.'); $table->text('notes')->nullable(); $table->dateTime('created_date')->nullable() ->comment('Date and time meter was read.'); $table->integer('created_by'); $table->dateTime('modified_date')->nullable(); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** CONTACTS ***********/ public function up() { Schema::create('contacts', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('buildings_id')->nullable() ->comment('Foreign key to the buildings table.'); $table->string('last_name', 25)->nullable(); $table->string('first_name', 25)->nullable(); $table->string('email', 150)->nullable(); $table->string('org_job_title', 50)->nullable() ->comment('Org title as assigned by org, NOT an SPC defined title.'); $table->text('notes')->nullable(); $table->integer('stardoc_user_id')->nullable(); $table->integer('email_group_id')->nullable() ->comment('id for the SPC defined title used for sending group emails.'); $table->dateTime('created_date')->nullable() ->comment('Date and time contact was created.'); $table->integer('created_by'); $table->dateTime('modified_date')->nullable(); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** CONTACTS_X_BUILDINGS ***********/ public function up() { Schema::create('contacts_x_buildings', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('contact_type')->nullable() ->comment('decision_maker from tblContacts or bldg_contact_id from buildings table.'); $table->integer('contacts_id')->nullable() ->comment('Foreign key to the contacts table.'); $table->integer('buildings_id')->nullable() ->comment('Foreign key to the buildings table.'); }); } /*********** CURRENT_DEVICES ***********/ public function up() { Schema::create('current_devices', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->integer('org_id'); $table->integer('bldg_id'); $table->integer('dept_id')->nullable(); $table->integer('room_id')->nullable(); $table->integer('school_year')->nullable(); $table->integer('vendor_id')->nullable(); $table->string('vendor_mach_id', 25)->nullable(); $table->integer('model_id')->nullable(); $table->text('features_list')->nullable(); $table->string('serial_number', 25); $table->char('mach_condition', 1)->nullable() ->comment('N=New, R=Reconditioned'); $table->date('install_date')->nullable(); $table->integer('projected_vol_black')->nullable(); $table->decimal('cpc_black', 7, 6)->nullable(); $table->decimal('new_cpc_black', 7, 6)->nullable(); $table->date('meter_begin_date')->nullable(); $table->integer('meter_begin_read_black')->nullable(); $table->date('meter_end_date')->nullable(); $table->integer('meter_end_read_black')->nullable(); $table->integer('meter_begin_read_color')->nullable(); $table->integer('meter_end_read_color')->nullable(); $table->decimal('cpc_color', 7, 6)->nullable(); $table->decimal('new_cpc_color', 7, 6)->nullable(); $table->integer('projected_vol_color')->nullable(); $table->text('device_comments')->nullable(); $table->char('lease_own', 1)->nullable() ->comment('Type of Possession. L=Leased, O=Owned, R=Rental, B=Loaner(Borrowed)'); $table->decimal('cpc_black_vendor', 7, 6)->nullable(); $table->decimal('cpc_color_vendor', 7, 6)->nullable(); $table->decimal('new_cpc_black_vendor', 7, 6)->nullable(); $table->decimal('new_cpc_color_vendor', 7, 6)->nullable(); $table->string('replacement_for', 25)->nullable(); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** DEPARTMENTS ***********/ public function up() { Schema::create('departments', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('organizations_id')->comment('FKey to organizations table'); $table->string('dept_name', 50)->nullable(); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** EMAIL_GROUP_TITLES ***********/ public function up() { Schema::create('email_group_titles', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('email_group_title', 30) ->comment('SPC defined title used for sending group emails.'); $table->dateTime('created_date')->nullable() ->comment('Date and time email_group_title was created.'); $table->integer('created_by'); $table->dateTime('modified_date')->nullable(); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** FAILED_JOBS (LARAVEL DEFAULT) ***********/ public function up() { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); /*This column was NOT in the previous version of laravel*/ $table->string('uuid')->unique(); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->longText('exception'); $table->timestamp('failed_at')->useCurrent(); }); } /*********** FLOORPLAN_DIAGRAMS ***********/ public function up() { Schema::create('floorplan_diagrams', function (Blueprint $table) { $table->id(); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /* I am not sure what this was for. Possibly to replace the year (y2019m etc) tables?? */ /*********** FLOORPLAN_MACHINE_HISTORIES ***********/ public function up() { Schema::create('floorplan_machine_histories', function (Blueprint $table) { $table->id(); $table->timestamps(); }); } /*********** FLOORPLAN_MACHINES ***********/ public function up() { Schema::create('floorplan_machines', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->integer('fm_audit_id')->nullable() ->comment('FK for machines in FM Audits records.'); $table->integer('machines_id')->nullable() ->comment('FK machines.machines_id for Proposed Machines '); $table->integer('present_machines_id')->nullable() ->comment('FK machines.machines_id for machines currently being used'); $table->integer('x_position')->nullable() ->comment('Proposed X Position of machine on floorplan map.'); $table->integer('y_position')->nullable() ->comment('Proposed Y Position of machine on floorplan map.'); $table->integer('floorplans_id')->nullable() ->comment('FK for floorplans table'); $table->integer('departments_id')->nullable() ->comment('FK for departments table'); $table->string('room_name', 40)->nullable() ->comment('Was room_number in old table. Current room number or name'); $table->string('serial_number', 25)->nullable() ->comment('Proposed serial_number'); $table->string('mac_address', 30)->nullable() ->comment('Mac address from FM Audit.'); $table->string('ip_address', 30)->nullable() ->comment('IP address from FM Audit.'); //$table->string('vendor_device_id', 25)->nullable() ->comment('The id that the vendor generates for a specific machine.'); //$table->string('new_vendor_device_id', 25)->nullable() ->comment('Proposed vendor machine id number generated by vendor.'); $table->string('present_vendor_mach_id', 50)->nullable() ->comment('The id that the vendor generates for a specific machine.'); $table->string('proposed_vendor_mach_id', 50)->nullable() ->comment('Proposed vendor machine id number generated by vendor.'); $table->integer('budgeted_black')->nullable() ->comment('Budgeted black volume'); $table->integer('budgeted_color')->nullable() ->comment('Budgeted color volume'); $table->decimal('cpc_black', 10, 6)->nullable() ->comment('cost per copy black'); $table->decimal('cpc_color', 10, 6)->nullable() ->comment('cost per copy color'); $table->integer('five_year_id')->nullable(); $table->integer('proposed_type_id')->nullable() ->comment('Proposed machine type. orig type_id - Kept for now, but may not need'); $table->integer('present_type_id')->nullable() ->comment('Present machine type. Kept for now, but may not need'); $table->char('is_proposed', 1)->nullable() ->comment('Y=yes, N=no, U=??'); $table->char('under_contract', 1)->nullable() ->comment('Is the device under contract with SPC. Y=yes, N=no, U=??'); $table->dateTime('commencement_date')->nullable() ->comment('Date device came on line.'); $table->integer('commencement_black_meter')->nullable(); $table->integer('commencement_color_meter')->nullable(); $table->dateTime('closeout_date')->nullable(); $table->integer('present_floorplan_id')->nullable() ->comment('FK Floorplan table where machine is currently located'); $table->integer('present_x_position')->nullable() ->comment('Current x position on floorplan map.'); $table->integer('present_y_position')->nullable() ->comment('Current y position on floorplan map.'); $table->string('present_serial_number', 25) ->nullable()->comment('Current serial_number'); $table->integer('fyer_group_id')->nullable() ->comment('FK to fyer_group table. Col old name was save_name_id'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** FLOORPLANS ***********/ public function up() { Schema::create('floorplans', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->integer('buildings_id'); $table->string('floor_number', 35)->nullable(); $table->string('floorplan_image', 35)->nullable(); $table->string('last_audited_by', 50)->nullable() ->comment('This col was kept as original string due to the wide variety of names.'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** FYER_GROUPS (TABLE NAME SHOULD BE PLURAL) ***********/ public function up() { Schema::create('fyer_group', function (Blueprint $table) { $table->increments('id', 11); $table->integer('org_id'); $table->integer('school_year'); $table->string('fyer_prop_vendor', 100)->nullable() ->comment="Proposed Vendor"; $table->string('fyer_save_name', 100)->nullable(); $table->char('fyer_final', 1)->default("N")->nullable() ->comment="Y=Yes N=No"; $table->dateTime('survey_date')->nullable(); $table->dateTime('upgrade_date')->nullable(); $table->decimal('fyer_govt_lease', 12, 2)->nullable(); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); //$table->timestamps(); }); } /*********** GAUGES (NOT FINISHED) ***********/ public function up() { Schema::create('gauges', function (Blueprint $table) { $table->id(); $table->timestamps(); }); } /*********** MACHINES ***********/ public function up() { Schema::create('machines', function (Blueprint $table) { $table->bigIncrements('id') ->comment('The id for this record. This is NOT the model_id.'); $table->integer('model_id'); $table->string('make', 40)->nullable(); $table->string('model', 30)->nullable() ->comment('Model name, example: Laser Jet 9000'); $table->integer('machine_types_id')->nullable() ->comment('Was model_type in old table. FK to the machine_types table'); $table->string('features', 200)->nullable() ->comment('Features of this machine'); $table->string('machine_image', 50)->nullable() ->comment('The file name of the image for this machine'); $table->date('intro')->nullable(); $table->integer('life')->nullable() ->comment('Amount of copies machine is expected to print.????'); $table->integer('min_speed')->nullable() ->comment('The minimum amt of copies/minute that this printer can print.'); $table->integer('max_speed')->nullable() ->comment('The maximum amt of copies/minute that this printer can print.'); $table->text('meter_read_dir')->nullable() ->comment('Instructions for reading the meter on this machine.'); $table->char('is_color', 1)->nullable() ->comment('Was 0 or 1 before. Is this a color machine? Y=yes, N=no'); $table->char('auto_created', 1)->nullable() ->comment('Was this record auto-generated? Y=yes, N=no'); /*New columns that were not in original table*/ $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** MACHINES AGAIN - DELETE ONE OF THE SCRIPTS OF DIFF NAMES ***********/ public function up() { Schema::create('machines', function (Blueprint $table) { $table->bigIncrements('id') ->comment('The id for this record. This is NOT the model_id.'); $table->integer('model_id'); $table->string('make', 40)->nullable(); $table->string('model', 30)->nullable() ->comment('Model name, example: Laser Jet 9000'); $table->integer('machine_types_id')->nullable() ->comment('Was model_type in old table. FK to the machine_types table'); $table->string('features', 200)->nullable() ->comment('Features of this machine'); $table->string('machine_image', 50)->nullable() ->comment('The file name of the image for this machine'); $table->date('intro')->nullable(); $table->integer('life')->nullable() ->comment('Amount of copies machine is expected to print.????'); $table->integer('min_speed')->nullable() ->comment('The minimum amt of copies/minute that this printer can print.'); $table->integer('max_speed')->nullable() ->comment('The maximum amt of copies/minute that this printer can print.'); $table->text('meter_read_dir')->nullable() ->comment('Instructions for reading the meter on this machine.'); $table->char('is_color', 1)->nullable() ->comment('Was 0 or 1 before. Is this a color machine? Y=yes, N=no'); $table->char('auto_created', 1)->nullable() ->comment('Was this record auto-generated? Y=yes, N=no'); /*New columns that were not in original table*/ $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** MACHINE_ARCHIVE ***********/ public function up() { Schema::create('machine_archive', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('org_id'); $table->integer('buildings_id'); $table->integer('dept_id')->nullable(); $table->string('room_name', 50)->nullable(); $table->integer('school_year')->nullable(); $table->integer('vendor_id')->nullable() ->comment('FK id in the organization table'); $table->string('vendor_mach_id', 25)->nullable(); $table->integer('machines_id')->nullable() ->comment('FK machines.machines_id. Was model_id in old table.'); //$table->integer('model_id')->nullable(); $table->text('features_list')->nullable() ->comment('Was Features in old table. Used to list the array of features for this machine.'); $table->string('serial_number', 25) ->comment('Was SerialNumber in old table.'); $table->char('mach_condition', 1)->nullable() ->comment('Was Condition in old table. N=New, R=Reconditioned'); $table->date('install_date')->nullable() ->comment('Was Install in old table.'); $table->integer('projected_volume_black')->nullable() ->comment('Was Anticipated in old table.'); $table->decimal('cpc_black', 7, 6)->nullable() ->comment('Was CostCopy in old table.'); $table->decimal('new_cpc_black', 7, 6)->nullable() ->comment('Was NewCostCopy in old table.'); $table->date('meter_begin_date')->nullable() ->comment('Was BDate in old table.'); $table->integer('meter_begin_read_black')->nullable() ->comment('Was Begin in old table.'); $table->date('meter_end_date')->nullable() ->comment('Was EDate in old table.'); $table->integer('meter_end_read_black')->nullable() ->comment('Was End in old table.'); $table->integer('meter_begin_read_color')->nullable() ->comment('Was MstrBegin in old table.'); $table->integer('meter_end_read_color')->nullable() ->comment('Was MstrEnd in old table.'); $table->decimal('cpc_color', 7, 6)->nullable() ->comment('Was Mstrcpc in old table.'); $table->decimal('new_cpc_color', 7, 6)->nullable() ->comment('Was NewColorCPC in old table.'); $table->integer('projected_volume_color')->nullable() ->comment('Was ProjColorVol in old table.'); $table->text('device_comments')->nullable() ->comment('Was Comments in old table.'); $table->char('lease_own', 1)->nullable() ->comment('Was lease in old table. Type of Possession. L=Leased, O=Owned, R=Rental, B=Loaner(Borrowed)'); /*$table->bid_date(); $table->bid_meter(); $table->contract_exp_date(); $table->storage();*/ $table->decimal('cpc_black_vendor', 7, 6)->nullable() ->comment('Was Black_Vendor_cpc in old table.'); $table->decimal('cpc_color_vendor', 7, 6)->nullable() ->comment('Was Color_Vendor_cpc in old table.'); $table->decimal('new_cpc_black_vendor', 7, 6)->nullable() ->comment('Was New_Blk_Ven_cpc in old table.'); $table->decimal('new_cpc_color_vendor', 7, 6)->nullable() ->comment('Was New_Color_Ven_cpc in old table.'); $table->string('replacement_for', 25)->nullable() ->comment('Was txtReplacedMachine in old table.'); $table->dateTime('last_meter_import')->nullable() ->comment('New column, was not in old table.'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); $table->index('serial_number', 'idx_serNum'); $table->index(['serial_number', 'created_date'], 'idx_serNum_date'); }); /*********** MACHINE_STATUSES ***********/ public function up() { Schema::create('machine_statuses', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('serial_number', 30); $table->integer('machine_id')->nullable(); $table->char('toner', 1)->nullable() ->comment('Is toner needed for this device? Y=Yes N=No'); $table->char('service_needed', 1)->nullable() ->comment('Is service needed for this device? Y=Yes N=No'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); $table->index('serial_number', 'idx_serNum'); $table->index(['serial_number', 'created_date'], 'idx_serNum_date'); }); } /*********** MACHINE_TYPES ***********/ public function up() { Schema::create('machine_types', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('type_name'); $table->string('machine_type', 25)->nullable(); $table->string('icon_type', 30)->nullable() ->comment('Type of image for devices on the floorplan.'); $table->char('is_color', 1)->nullable() ->comment('Is this a color device? Y=Yes N=No'); $table->char('covered', 1)->nullable() ->comment('Is this device covered by SPC? Y=Yes N=No'); $table->decimal('black_cpc_markup', 11, 2)->nullable(); $table->decimal('color_cpc_markup', 11, 2)->nullable(); $table->char('printer_copier', 1)->nullable() ->comment('Is this device a printer or copier?? P=Printer C=Copier'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** METERS ***********/ public function up() { Schema::create('meters', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->string('serial_number')->nullable() ->comment('FKey to the current_devices table. Device serial number'); $table->integer('machines_id') ->comment('FKey to the current_devices table'); $table->integer('black_meter') ->comment('Device meter read for black volume'); $table->integer('color_meter')->nullable() ->comment('Device meter read for color volume'); $table->dateTime('created_date') ->comment('Date and time meter was read.'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); $table->index('serial_number', 'idx_serNum'); $table->index(['serial_number', 'created_date'], 'idx_serNum_date'); }); } /*********** ORGANIZATIONS ***********/ public function up() { Schema::create('organizations', function (Blueprint $table) { $table->increments('id', 11); $table->string('org_name', 75) ->comment = 'Name of the organization'; $table->string('org_short_name', 15)->nullable() ->comment = 'Abbreviated name of the organization'; $table->integer('org_type_id')-> comment="FK to organization_type.id"; $table->string('website', 100)->nullable(); $table->date('last_update')->nullable(); $table->string('org_comments', 700)->nullable(); $table->date('client_since')->nullable(); $table->char('client_status', 1)->nullable() ->comment="Is the client an active client? A=Active P=Prospective I=Inactive N=NonActive"; $table->char('print_mgmt_software_installed', 1)->nullable() ->comment="Is the client active on stardoc? Y=Yes N=No"; $table->char('lenp_contract_signed', 1)->nullable() ->comment="Y=Yes N=No"; $table->integer('fmaudit_client_id')->nullable(); $table->date('commencement_date')->nullable(); $table->char('display_meter_data', 1)->nullable() ->comment="Y=Yes N=No"; $table->string('meter_data_feed', 10)->nullable(); $table->string('client_logo', 30)->nullable(); $table->string('gm_notes', 300)->nullable(); $table->string('org_message', 300)->nullable(); $table->decimal('bank_buyout', 11,2)->nullable(); $table->decimal('spc_service_fee', 11,2)->nullable(); $table->integer('trade_out_deletion')->nullable(); $table->date('new_upgrade_date')->nullable(); $table->char('temp_inactive', 1)->default("N") ->comment="Y means temporarily inactive during upgrade. Defaults to N for No. Used in reports."; $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** ORGANIZATION_TYPES ***********/ public function up() { Schema::create('organization_types', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('org_type_name', 25); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** ORG_CONTACTS ***********/ /*I think this is not needed. I believe the table that supplies this data is people*/ public function up() { Schema::create('org_contacts', function (Blueprint $table) { $table->id(); $table->timestamps(); }); } /*********** PASSWORD_RESETS (LARAVEL DEFAULT) ***********/ public function up() { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); } /*********** PEOPLE ***********/ public function up() { Schema::create('people', function (Blueprint $table) { //$table->id(); $table->increments('id', 11); $table->string('first_name', 26); $table->string('last_name', 25); $table->integer('organization_id')->nullable(); $table->integer('bldg_id')->nullable(); $table->string('position', 30)->nullable() ->comment = 'The position, as given by the user.'; $table->string('user_name', 50); $table->string('password', 100); $table->integer('user_level') ->comment = 'The level of access allowed for this user'; $table->integer('org_user_level') ->comment = 'The level of access allowed for this user'; $table->string('email', 100)->unique()->nullable(); $table->char('primary_user', 1)->nullable() ->comment = 'Y = yes, N = no'; $table->char('primary_contact', 1)->nullable() ->comment = 'Y = yes, N = no'; $table->char('active', 1)->default('Y') ->comment = 'Y = yes, N = no'; $table->char('toner_alert', 1)->default('N') ->comment = 'Y = yes, N = no'; $table->char('service_alert', 1)->default('N') ->comment = 'Y = yes, N = no'; $table->char('audit_reports', 1)->default('N') ->comment = 'Y = yes, N = no'; $table->char('change_password_on_login', 1)->default('N') ->comment = 'Y = yes, N = no'; $table->char('hover_enabled', 1)->nullable() ->comment = 'Y = yes, N = no'; $table->text('security_profile')->nullable(); $table->char('test_user', 1)->default('N') ->comment = 'Y = yes, N = no'; $table->string('admin_photo_url', 100)->nullable() ->comment = 'the url of where the admin photo is stored'; $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** PHONES ***********/ public function up() { Schema::create('phones', function (Blueprint $table) { //$table->id(); $table->increments('id', 11); $table->char('phone_type', 1) ->comment = 'Type of number M=Main, C=Cell, F=Fax, A=Additional'; $table->char('owner_type', 1) ->comment = 'The owner of the number can be an org, person, or building O=org, P=person, B=building, U=User'; $table->integer('owner_id') ->comment = 'The id of the org or the id of the person to whom the number belongs.'; $table->char('area_code', 3) ->comment = 'The 3 digit area code with no hyphens () or special chars'; $table->char('exch', 3) ->comment = 'The 3 digit phone exchange with no hyphens () or special chars'; $table->char('phone_line', 4) ->comment = 'The last 4 digits of the phone number are the actual phone line'; $table->char('extension', 8)->nullable() ->comment = 'If there is a specific extension, it will be here.'; $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** SCHOOL_YEARS ***********/ public function up() { Schema::create('school_years', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->string('school_year', 9); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** TBL_WHAT_IFS ***********/ public function up() { Schema::create('tbl_what_ifs', function (Blueprint $table) { $table->bigIncrements('id', 11); $table->integer('fyer_group_id') ->comment('FK to fyer_group table. Col old name was save_name_id'); $table->integer('floorplan_machines_id')->nullable() ->comment('FK to floorplan_machines table'); $table->integer('report_id')->nullable() ->comment('Sequential # for the fyer report. Was ID# in old table'); $table->integer('buildings_id')->comment('FK to buildings table.'); $table->string('new_serial_number', 25)->nullable() ->comment('Proposed device serial_number'); $table->string('serial_number', 25)->nullable() ->comment('Proposed device serial_number'); $table->string('features_list', 250)->nullable() ->comment('List of features'); $table->string('speed', 50)->nullable(); $table->integer('annual_volume')->nullable(); $table->integer('bid_meter')->nullable(); $table->date('intro_date')->nullable() ->comment('Date machine was introduced.'); $table->integer('life')->nullable()->comment('Life of the machine.'); $table->string('move_to', 50)->nullable() ->comment('Machine move to location.'); $table->string('move_from', 50)->nullable() ->comment('Machine move from location.'); $table->string('first_year_equip', 255)->nullable(); $table->integer('proposed_volume_black')->nullable(); $table->string('second_year_equip', 50)->nullable(); $table->string('third_year_equip', 50)->nullable(); $table->string('fourth_year_equip', 50)->nullable(); $table->string('fifth_year_equip', 50)->nullable(); $table->string('proposed_vendor_mach_id', 50)->nullable() ->comment('Was NewVendorID in old table'); $table->string('present_vendor_mach_id', 50)->nullable() ->comment('Was VendorID in old table'); $table->integer('vendor_id')->nullable() ->comment('FK to organizations table. Was VendorName in old table'); $table->decimal('cpc_black', 7, 6)->nullable() ->comment('The current black cpc. Was AdjCostCopy in old table'); $table->integer('proposed_type_id')->nullable() ->comment('Was GroupTag in old table. FK to machine_types table'); $table->decimal('proposed_cpc_black', 7, 6)->nullable() ->comment('The proposed black cpc. Was PropCost in old table'); $table->integer('forced_upgrades')->nullable() ->comment('Was ForcedUpgrades in old table'); $table->decimal('service_supplies', 10, 4)->nullable() ->comment('Was SS&S in old table'); $table->date('install_date')->nullable() ->comment('Was Install in old table'); $table->char('lease_own', 1)->nullable() ->comment('Was lease in old table Type of Possession. L=Leased, O=Owned, R=Rental, B=Loaner(Borrowed)'); $table->integer('color_volume')->nullable() ->comment('Was Color_Vol in old table'); $table->decimal('cpc_color', 7, 6)->nullable() ->comment('Was Color_CPC in old table'); $table->decimal('proposed_cpc_color', 7, 6)->nullable() ->comment('Was NewColorCPC in old table'); $table->integer('proposed_volume_color')->nullable() ->comment('Was ProjColorVol in old table'); $table->string('ip_address', 50)->nullable() ->comment('Was IP_Address in old table'); $table->string('special_notes', 255)->nullable() ->comment('Was Special_Notes in old table'); $table->date('proposed_intro_date')->nullable() ->comment('Was prop_intro in old table'); $table->integer('proposed_life')->nullable() ->comment('Was prop_life in old table'); $table->string('mac_address', 50)->nullable(); $table->integer('present_type_id')->nullable() ->comment('??FK to machine_types table'); $table->integer('present_model_id')->nullable() ->comment('??FK to machine_types table'); $table->integer('proposed_model_id')->nullable()->comment('??'); $table->integer('present_floorplan_id')->nullable()->comment('??'); $table->string('present_room_name', 50)->nullable() ->comment('Was present_room_number in old table. Room number or name'); $table->integer('close_out_black_meter')->nullable() ->comment('Device meter read for black volume'); $table->integer('close_out_color_meter')->nullable() ->comment('Device meter read for color volume'); $table->integer('commencement_black_meter')->nullable() ->comment('Device meter read for black volume'); $table->integer('commencement_color_meter')->nullable() ->comment('Device meter read for color volume'); $table->integer('dept_id')->nullable(); $table->decimal('vendor_cpc_black_present', 7, 6)->nullable() ->comment('Was vendor_black_cpc_present in old table.'); $table->decimal('vendor_cpc_color_present', 7, 6)->nullable() ->comment('Was vendor_color_cpc_present in old table.'); $table->decimal('vendor_cpc_black_proposed', 7, 6)->nullable() ->comment('Was vendor_black_cpc_proposed'); $table->decimal('vendor_cpc_color_proposed', 7, 6)->nullable() ->comment('Was vendor_color_cpc_proposed'); $table->decimal('raw_equip_cost', 10, 4)->nullable() ->comment('This field is the purchase price of the machine.'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** TECH ASSETS ***********/ public function up() { Schema::create('tech_assets', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->integer('org_id'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); /*$table->integer('bldg_id'); $table->integer('dept_id')->nullable(); $table->integer('room_id')->nullable(); $table->integer('school_year')->nullable(); $table->integer('vendor_id')->nullable(); $table->string('vendor_mach_id', 25)->nullable(); $table->integer('model_id')->nullable(); $table->text('features_list')->nullable(); $table->string('serial_number', 25); $table->char('mach_condition', 1)->nullable() ->comment('N=New, R=Reconditioned'); $table->date('install_date')->nullable();*/ }); /*********** USERS ***********/ public function up() { Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); /*This enum column was not in users table by default*/ $table->enum('role', ['writer', 'admin'])->default('writer'); $table->rememberToken(); $table->timestamps(); }); } /*********** Y2019_FLOORPLAN_MACHINES ***********/ public function up() { Schema::create('y2019_floorplan_machines', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('fm_audit_id')->nullable(); $table->integer('machines_id')->nullable() ->comment('FK machines.machines_id for Proposed Machines'); $table->integer('present_machines_id')->nullable() ->comment('FK machines.machines_id for machines currently being used'); $table->integer('x_position')->nullable() ->comment('Proposed x position of device on the floorplan'); $table->integer('y_position')->nullable() ->comment('Proposed y position of device on the floorpln'); $table->integer('floorplans_id')->nullable() ->comment('FK to the floorplans table.'); $table->integer('departments_id')->nullable() ->comment('FK to the departments table.'); $table->string('room_name', 50)->nullable() ->comment('Was room_number in old table. Current room number or name'); $table->string('serial_number', 25)->nullable() ->comment('Proposed serial_number'); $table->string('mac_address', 50)->nullable() ->comment('Mac address from FM Audit.'); $table->string('ip_address', 50)->nullable() ->comment('Was IP_Address in old table. Comes from FM Audit.'); $table->string('present_vendor_mach_id', 50)->nullable() ->comment('Was vendor_device_id in old table. The id that the vendor generates for a specific machine.'); $table->string('proposed_vendor_mach_id', 50)->nullable() ->comment('Was new_vendor_device_id in old table. The id that the vendor generates for a specific machine.'); $table->integer('budgeted_black')->nullable() ->comment('Budgeted black volume'); $table->integer('budgeted_color')->nullable() ->comment('Budgeted color volume'); $table->decimal('cpc_black', 10, 6)->nullable() ->comment('cost per copy black'); $table->decimal('cpc_color', 10, 6)->nullable() ->comment('cost per copy color'); $table->integer('five_year_id')->nullable(); $table->integer('proposed_type_id')->nullable() ->comment('Proposed machine type. orig type_id - Kept for now, but may not need'); $table->integer('present_type_id')->nullable() ->comment('Present machine type. Kept for now, but may not need'); $table->char('is_proposed', 1)->nullable() ->comment('Y=yes, N=no, U=??'); $table->char('under_contract', 1)->nullable() ->comment('Is the device under contract with SPC. Y=yes, N=no, U=??'); $table->dateTime('commencement_date')->nullable() ->comment('Date device came on line.'); $table->integer('commencement_black_meter')->nullable(); $table->integer('commencement_color_meter')->nullable(); $table->dateTime('closeout_date')->nullable(); $table->integer('present_floorplan_id')->nullable() ->comment('FK Floorplan table where machine is currently located'); $table->integer('present_x_position')->nullable() ->comment('Current x position on floorplan map.'); $table->integer('present_y_position')->nullable() ->comment('Current y position on floorplan map.'); $table->string('present_serial_number', 25)->nullable() ->comment('Current serial_number'); $table->integer('fyer_group_id')->nullable() ->comment('FK to fyer_group table. Col old name was save_name_id'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); }); } /*********** Y2019_MACHINE_STATUS ***********/ public function up() { Schema::create('y2019_machine_status', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->string('serial_number', 30); $table->integer('machine_id')->nullable(); $table->char('toner', 1)->nullable() ->comment('Is toner needed for this device? Y=Yes N=No'); $table->char('service_needed', 1)->nullable() ->comment('Is service needed for this device? Y=Yes N=No'); $table->dateTime('created_date'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); $table->index('serial_number', 'idx_serNum'); $table->index(['serial_number', 'created_date'], 'idx_serNum_date'); }); } /*********** Y2019_METERS ***********/ public function up() { Schema::create('y2019_meters', function (Blueprint $table) { //$table->id(); $table->bigIncrements('id'); $table->string('serial_number')->nullable() ->comment('FKey to the current_devices table. Device serial number'); $table->integer('machine_id')->nullable() ->comment('We may drop this col. FKey to the current_devices table'); $table->integer('black_meter') ->comment('Device meter read for black volume'); $table->integer('color_meter')->nullable() ->comment('Device meter read for color volume'); $table->dateTime('created_date') ->comment('Date and time meter was read.'); $table->integer('created_by'); $table->dateTime('modified_date'); $table->integer('modified_by'); $table->dateTime('deleted_date')->nullable(); $table->index('serial_number', 'idx_serNum'); $table->index(['serial_number', 'created_date'], 'idx_serNum_date'); }); }