Skip to content

Script for Database - #204

Open
NathanielObeso wants to merge 6 commits into
acmcsufoss:mainfrom
NathanielObeso:script
Open

NathanielObeso wants to merge 6 commits into
acmcsufoss:mainfrom
NathanielObeso:script

Conversation

@NathanielObeso

Copy link
Copy Markdown

Created a script that could be ran into database, along with adding the files officer.json and tiers.json.

Populates officer, position, and tier tables

closes #44

@TheJolman TheJolman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for slow review and ty for the cobtrib! Can we not include the two JSON files in the repo here? The script should be able to either access them from the live site or maybe from raw.githubusercontent.com

@NathanielObeso NathanielObeso left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Finished the script to pull from somewhere else

@GaballaGit

Copy link
Copy Markdown
Member

@TheJolman Do you think the script should call the database directly or the api?

Also another comment, we should have a scripts/ directory in the project.

@TheJolman

Copy link
Copy Markdown
Collaborator

@TheJolman Do you think the script should call the database directly or the api?

Also another comment, we should have a scripts/ directory in the project.

API, and I agree on ur second point

@TheJolman

Copy link
Copy Markdown
Collaborator

@GaballaGit if he hits it via tha API does it generate the UUID for him or not? I feel like it doesn't lol

@TheJolman TheJolman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As Gaballa pointed out, this script should be populating the DB via hitting the API. This is because when we populate the production database, it would be unwieldy to run something like this while the service is live (likely deployed in a container). The API also provides a layer of validation that we should be using for something like this. You don't have to worry about auth for now and can pass dev-token for the bearer token if you encounter that. Thanks!

@GaballaGit

GaballaGit commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

@GaballaGit if he hits it via tha API does it generate the UUID for him or not? I feel like it doesn't lol

No it does not, we will have to generate a random UUID every time. Or we could try making a function like done here (though this is for posgresql): sqlc-dev/sqlc#1354 (comment)

@TheJolman

Copy link
Copy Markdown
Collaborator

@GaballaGit if he hits it via tha API does it generate the UUID for him or not? I feel like it doesn't lol

No it does not, we will have to generate a random UUID every time. Or we could try making a function like done here (though this is for posgresql): sqlc-dev/sqlc#1354 (comment)

I feel this is something that can easily be added to the service layer. I'll make an issue

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script to populate database

3 participants