Skip to content

Instantly share code, notes, and snippets.

View scottpnelson's full-sized avatar

Scott N scottpnelson

View GitHub Profile
@scottpnelson
scottpnelson / README.md
Last active June 3, 2024 14:07
Automatic MySQL database setup from .env file contents

About

This script will automatically create a new MySQL database for you by reading your MySQL database name, host name, and user credentials from your .env file. This allows you to keep your database details safe, in a single location. Ideal for deployment and security.

Installation

1. Download setup_mysql.sh to your project root directory 2. You can modify setup_mysql.sh to set the following: - ENV_FILE (the relative path to your .env file -- e.g. ENV_FILE="./.env.local") - DEFAULT_MYSQL_HOST (the host name of your MySQL server -- e.g. "localhost") - DEFAULT_MYSQL_ADMIN_USERNAME (the administrator username of your mysql server -- e.g. "root" (note: this is typically NOT the MySQL username of your app). This should be no longer than 16 characters. Some versions of MySQL allow for longer lengths. You can modify the MAX_MYSQL_USERNAME_LENGTH variable to change this length. - DEFAULT_MYSQL_ADMIN_PASSWORD (the administrator password of your mysql admin user -- e.g
[{"name":"users","color":"Red","position":{"x":143,"y":125},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"supp_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":true,"ui":true,"in":false,"un":true,"fillable":true,"guarded":false,"visible":false,"hidden":false,"colid":"c93","order":0}],"relation":[{"extramethods":"","foreignkeys":"entry_key","name":"entryKey","relatedmodel":"user_keys","relationtype":"hasOne","usenamespace":""}],"seeding":[]},{"name":"user_keys","color":"Red","position":{"x":630,"y":125},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"entry_key","type":"string","length":"8","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":true,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c50","order":0}],"relation":[{"extramethods":"","foreignkeys":"id","name":"userId","relatedmodel":"users","relationtype":"belongsTo","usenamespace":""}],"seeding":
@scottpnelson
scottpnelson / fmt-deliveries migrations.skema
Created January 15, 2015 07:40
FMT Deliveries Migrations Design
[{"name":"users","color":"Red","position":{"x":113,"y":161},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"supp_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":true,"ui":true,"in":false,"un":true,"fillable":true,"guarded":false,"visible":false,"hidden":false,"colid":"c93","order":0}],"relation":[],"seeding":[]},{"name":"user_keys","color":"Red","position":{"x":597,"y":126},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"entry_key","type":"string","length":"8","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":true,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c50","order":0}],"relation":[{"extramethods":"","foreignkeys":"id","name":"userId","relatedmodel":"users","relationtype":"belongsTo","usenamespace":""}],"seeding":[]}]
[{"name":"users","color":"Red","position":{"x":104,"y":113},"increment":false,"timestamp":false,"softdelete":false,"column":[{"name":"username","type":"string","length":"50","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":true,"fillable":true,"guarded":false,"visible":false,"hidden":false,"colid":"c112","order":0},{"name":"password","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":true,"visible":false,"hidden":true,"colid":"c128","order":1},{"name":"role_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c465","order":2}],"relation":[],"seeding":[[{"colid":"c112","content":"scott"},{"colid":"c128","content":"password"},{"colid":"c465","content":""}]]},{"name":"roles","color":"Red","position":{"x":621,"y":156},"
@scottpnelson
scottpnelson / fmt_portal.skema
Created October 6, 2014 11:24
FMT Portal DB
[{"name":"users","color":"Red","position":{"x":104,"y":113},"increment":false,"timestamp":false,"softdelete":false,"column":[{"name":"username","type":"string","length":"50","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":true,"fillable":true,"guarded":false,"visible":false,"hidden":false,"colid":"c112","order":0},{"name":"password","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":true,"visible":false,"hidden":true,"colid":"c128","order":1},{"name":"role_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c465","order":2}],"relation":[],"seeding":[[{"colid":"c112","content":"scott"},{"colid":"c128","content":"password"},{"colid":"c465","content":""}]]},{"name":"roles","color":"Red","position":{"x":621,"y":156},"