{"id":26380312,"url":"https://github.com/killercavin/webtechweek5","last_synced_at":"2025-03-17T05:19:41.369Z","repository":{"id":249866426,"uuid":"832710675","full_name":"Killercavin/WebTechWeek5","owner":"Killercavin","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-24T09:24:37.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-24T22:12:56.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Killercavin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-23T15:08:14.000Z","updated_at":"2024-07-24T09:24:40.000Z","dependencies_parsed_at":"2024-07-23T22:09:28.556Z","dependency_job_id":null,"html_url":"https://github.com/Killercavin/WebTechWeek5","commit_stats":null,"previous_names":["killercavin/webtechweek5"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Killercavin%2FWebTechWeek5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Killercavin%2FWebTechWeek5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Killercavin%2FWebTechWeek5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Killercavin%2FWebTechWeek5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Killercavin","download_url":"https://codeload.github.com/Killercavin/WebTechWeek5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976382,"owners_count":20377691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-17T05:19:40.509Z","updated_at":"2025-03-17T05:19:41.349Z","avatar_url":"https://github.com/Killercavin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database Managment with MySQL and Node.js\n\n## Steps \n\n### Installation\n\n#### NodeJS \u0026 MySQL\n- Make sure you have NodeJS and MySQL installed if ! head to their official websites using the links below\n- NodeJS visit [NodeJS](https://nodejs.org) for the guide to download \u0026 install\n- MySQL visit [MySQL](https://mysql.com) for download and install\n\n#### Clone the repo\n- Clone this repo in your desired directory\n```bash \ngit clone https://github.com/Killercavin/WebTechWeek5.git\n```\n\n#### Install required packages\n- Change directory to the project repo directory\n```sh \ncd WebTechWeek5 \n```\n- While in the repo directory install the following packages and create your `.env` file to hold your variables\n```sh\nnpm install sequelize mysql2 \nnpm install express\nnpm install dotenv\n```\n- Set up \u0026 initialize Sequelize in the project\n```sh\nnpx sequelize-cli init\n```\n- Configure sequelize and update the `config/config.json`\n```json\n{\n  \"development\": {\n    \"username\": \"your_username\",\n    \"password\": \"your_password\",\n    \"database\": \"expense_manager\",\n    \"host\": \"localhost\",\n    \"dialect\": \"mysql\"\n  },\n  \"test\": {\n    \"username\": \"your_username\",\n    \"password\": \"your_password\",\n    \"database\": \"database_test\",\n    \"host\": \"127.0.0.1\",\n    \"dialect\": \"mysql\"\n  },\n  \"production\": {\n    \"username\": \"your_username\",\n    \"password\": \"your_password\",\n    \"database\": \"database_production\",\n    \"host\": \"127.0.0.1\",\n    \"dialect\": \"mysql\"\n  }\n}\n```\n- Create models and migrations\n```sh\nnpx sequelize-cli model:generate --name User --attributes username:string,email:string,password:string,created_at:date,updated_at:date\nnpx sequelize-cli model:generate --name Expense --attributes user_id:integer,category_id:integer,amount:float,date:date,description:string,created_at:date,updated_at:date\nnpx sequelize-cli model:generate --name Category --attributes user_id:integer,category_name:string,created_at:date,updated_at:date\nnpx sequelize-cli model:generate --name PaymentMethod --attributes user_id:integer,payment_method_name:string,created_at:date,updated_at:date\nnpx sequelize-cli model:generate --name Budget --attributes user_id:integer,category_id:integer,amount:float,start_date:date,end_date:date,created_at:date,updated_at:date\n```\n- Update each model and migrations\n- Make migratons\n```sh\nnpx sequelize-cli db:migrate\n```\n- Sync models\n```javascript\nsequelize.sync()\n  .then(() =\u003e {\n    console.log('Database \u0026 tables created!');\n  })\n  .catch(err =\u003e {\n    console.error('Unable to connect to the database:', err);\n  });\n```\n\n### NOTE\n- Disclaimer! This repo has errors therefore didn't run successfully","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillercavin%2Fwebtechweek5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkillercavin%2Fwebtechweek5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillercavin%2Fwebtechweek5/lists"}