Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate houses/apartments from qb-houses/qb-apartments #89

Merged
merged 11 commits into from
Aug 22, 2023

Conversation

xXJamieXx
Copy link
Contributor

@xXJamieXx xXJamieXx commented Aug 2, 2023

Overview

Finishes the migration code for converting from qb-houses and qb-apartments.

Details

The code was previously started but not fully functional.
Adds a list of shells with their corresponding "tiers" from qb-houses.
Houses requires a client to callback from to receive street and region data for each house.
Apartments are fairly straightforward.

UI Changes / Functionality

N/A

Testing Steps

From client or server run the migrateapartments command to convert all apartments from qb-apartments.
From client run migratehouses command to convert all houses from qb-houses. Must be run from client as it fetches street and region data.

  • Did you test the changes you made?
  • Did you test core functionality of the script to ensure your changes do not regress other areas?
  • Did you test your changes in multiplayer to ensure it works correctly on all clients?

@ImXirvin
Copy link
Contributor

ImXirvin commented Aug 2, 2023

I thought, this was unused because we check their previous apartment when its created, unsure about their house though. If this works, it wouldnt be bad to include.

Though it needs an admin check on the command.

@MonkeyWhisper It would be good to see some testers for this.

Copy link
Contributor

@BackSH00TER BackSH00TER left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets update the readme as well with a note about these two commands for migrating existing qb apartments and houses over

server/migrate.lua Outdated Show resolved Hide resolved
client/migrate.lua Show resolved Hide resolved
@BackSH00TER
Copy link
Contributor

I thought, this was unused because we check their previous apartment when its created, unsure about their house though. If this works, it wouldnt be bad to include.

Though it needs an admin check on the command.

@MonkeyWhisper It would be good to see some testers for this.

@ImXirvin I had only written up a migration for the apartment stashes. We didnt do anything to actually migrate existing apartments and houses over to ps-housing, this PR accomplishes that aspect.

@JnKTechstuff
Copy link
Contributor

Tested and converted 270 properties and 7,740 apartments

Co-authored-by: BackSH00TER <[email protected]>
@BackSH00TER
Copy link
Contributor

@xXJamieXx Please update PR title to be a bit more descriptive, thx

@xXJamieXx xXJamieXx changed the title QB Migration Migrate houses/apartments from qb-houses/qb-apartments Aug 3, 2023
@MonkeyWhisper
Copy link
Member

We shall get a couple of people to test this to make sure all is working. Great PR, thanks @xXJamieXx

@MonkeyWhisper
Copy link
Member

@xXJamieXx, can you add to the current README? Steps on what should be done, thanks!

@DustDevelopment
Copy link

Worked for me. No errors everything works the same. I only had one house to for it to transfer just fyi.

@LeSiiN LeSiiN added ready for merge Reviewed and can be merged to main needs testing and removed needs testing ready for merge Reviewed and can be merged to main labels Aug 7, 2023
@SKITTLE6969
Copy link

SKITTLE6969 commented Aug 11, 2023

I tried this with my existing database of 2k player apartments and 1.4k houses
Overall everything got converted but except apartments and housing stashes
Once I place the new stash it doesn't open the inventory for some reason
Also got an SQL error on live console here for each an every conversion

shell = Config.Apartments[aptName].shell,

@MonkeyWhisper
Copy link
Member

I tried this with my existing database of 2k player apartments and 1.4k houses Overall everything got converted but except apartments and housing stashes Once I place the new stash it doesn't open the inventory for some reason Also got an SQL error on live console here for each an every conversion

shell = Config.Apartments[aptName].shell,

What's the error?

@SKITTLE6969
Copy link

SKITTLE6969 commented Aug 11, 2023

[ script:ps-housing] SCRIPT ERROR: @ps-housing/server/server.lua:80: attempt to index a nil value (local 'player')
[ script:ps-housing] > (@oxmysql/dist/build.js:21810)
[ script:ps-housing] > runMicrotasks (:0)
[ script:ps-housing] > processTicksAndRejections (node:internal/process/task_queues:96)

script:ps-housing] Cannot add or update a child row: a foreign key constraint fails (QBCoreFramework_C5D6BE.properties, CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON DELETE CASCADE ON UPDATE CASCADE)
[ script:ps-housing] INSERT INTO properties (owner_citizenid, street, region, description, has_access, extra_imgs, furnitures, for_sale, price, shell, apartment, door_data, garage_data) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ["UZM72154",null,null,"This is Alta Street Apartments Apartment 187","[]","[]","[]",0,0,"Apartment Unfurnished","Alta Street Apartments","[]","[]"]

https://media.discordapp.net/attachments/1122815926455242822/1139481864650895370/Screenshot_20230811_142111_Chrome.jpg

@MonkeyWhisper
Copy link
Member

@MonkeyWhisper here's the console log

https://cdn.discordapp.com/attachments/1122815926455242822/1139483085730234438/fxserver_1691744241.log.txt

This issue is with your database table

script:ps-housing] Cannot add or update a child row: a foreign key constraint fails (QBCoreFramework_C5D6BE.properties, CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON DELETE CASCADE ON UPDATE CASCADE)

@SKITTLE6969
Copy link

SKITTLE6969 commented Aug 12, 2023

@MonkeyWhisper here's the console log
https://cdn.discordapp.com/attachments/1122815926455242822/1139483085730234438/fxserver_1691744241.log.txt

This issue is with your database table

script:ps-housing] Cannot add or update a child row: a foreign key constraint fails (QBCoreFramework_C5D6BE.properties, CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON DELETE CASCADE ON UPDATE CASCADE)

ok i managed to sort that issue out, migratehouses command does nothing though O_O donsen't go after (print 5)

image
image
image

@xXJamieXx
Copy link
Contributor Author

@MonkeyWhisper here's the console log
https://cdn.discordapp.com/attachments/1122815926455242822/1139483085730234438/fxserver_1691744241.log.txt

This issue is with your database table
script:ps-housing] Cannot add or update a child row: a foreign key constraint fails (QBCoreFramework_C5D6BE.properties, CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON DELETE CASCADE ON UPDATE CASCADE)

ok i managed to sort that issue out, migratehouses command does nothing though O_O donsen't go after (print 5)

image image image

Latest change should resolve this. Callback name was changed on client but not reflected on server. :)

@MonkeyWhisper
Copy link
Member

@MonkeyWhisper here's the console log
https://cdn.discordapp.com/attachments/1122815926455242822/1139483085730234438/fxserver_1691744241.log.txt

This issue is with your database table
script:ps-housing] Cannot add or update a child row: a foreign key constraint fails (QBCoreFramework_C5D6BE.properties, CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON DELETE CASCADE ON UPDATE CASCADE)

ok i managed to sort that issue out, migratehouses command does nothing though O_O donsen't go after (print 5)
image image image

Latest change should resolve this. Callback name was changed on client but not reflected on server. :)

Shoot! That was my fault after I changed the callbacks name.

@SKITTLE6969
Copy link

SKITTLE6969 commented Aug 13, 2023

okay now its working as intended, but I had to drop the garage vector column as it was giving me below error (2).
Without garage data everything was converted. When with garage location data some gets converted but the garage access or the box zone doesn't appear. If I try to remove the converted garage below error appears in Live Console. I'm using radial menu garages from JDev

Converted garages/houses have a different name compared to the original so the existing parked vehicles in garages don't sync with the converted ones

Also Housing stashes doesn't get converted like in apartment stashes.

(1)
[ script:ps-housing] SCRIPT ERROR: @ps-housing/server/sv_property.lua:383: attempt to index a nil value (local 'garage')
[ script:ps-housing] > ? (@ps-housing/server/sv_property.lua:383)
[ script:ps-housing] > handler (@ps-housing/server/server.lua:127)
[ script:ps-housing] > handler (@ps-realtor/server/server.lua:17)

(2)
[ script:ps-housing] SCRIPT ERROR: @ps-housing/server/migrate.lua:93: attempt to perform arithmetic on a nil value (field 'h')
[ script:ps-housing] > fn (@ps-housing/server/migrate.lua:93)

image

@MonkeyWhisper MonkeyWhisper merged commit 6fc0626 into Project-Sloth:main Aug 22, 2023
@MonkeyWhisper
Copy link
Member

Tested and working on a QBCore default with changes.

@Sebaavv
Copy link

Sebaavv commented Sep 16, 2023

okay now its working as intended, but I had to drop the garage vector column as it was giving me below error (2). Without garage data everything was converted. When with garage location data some gets converted but the garage access or the box zone doesn't appear. If I try to remove the converted garage below error appears in Live Console. I'm using radial menu garages from JDev

Converted garages/houses have a different name compared to the original so the existing parked vehicles in garages don't sync with the converted ones

Also Housing stashes doesn't get converted like in apartment stashes.

(1) [ script:ps-housing] SCRIPT ERROR: @ps-housing/server/sv_property.lua:383: attempt to index a nil value (local 'garage') [ script:ps-housing] > ? (@ps-housing/server/sv_property.lua:383) [ script:ps-housing] > handler (@ps-housing/server/server.lua:127) [ script:ps-housing] > handler (@ps-realtor/server/server.lua:17)

(2) [ script:ps-housing] SCRIPT ERROR: @ps-housing/server/migrate.lua:93: attempt to perform arithmetic on a nil value (field 'h') [ script:ps-housing] > fn (@ps-housing/server/migrate.lua:93)

image

Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants