Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
This project is a database migration tool that helps manage and apply database schema changes. It uses a JSON file to define the changes and applies them to a MySQL database.
This project is a database migration tool that helps manage and apply database schema changes. It uses a JSON file to define the changes and applies them to a MySQL database. It is named after a bird called Arctic Tern which can migrate the longest distance. Yearly migration can range from 44,000 miles to 59,000 miles.
changes.json
: Contains the list of database changes to be applied.connection.py
: Manages the database connection pool.main.py
: Entry point for running the migration scripts.Makefile
: Contains commands to run the project.migration.py
: Contains functions to process migrations, calculate checksums, and insert data into the database.requirement.txt
: Lists the Python dependencies for the project.venv/
: Virtual environment directory.Create a Virtual Environment:
python -m venv venv
Activate the Virtual Environment:
.\venv\Scripts\activate
source venv/bin/activate
Install Dependencies:
pip install -r requirement.txt
To run the migrations, use the main.py script with the appropriate arguments.
Migrate Up:
python main.py --migrate up
Migrate Down:
python main.py --migrate down
You can also use the Makefile to run the project:
make run
get_connection_pool()
: Returns a MySQL connection pool.create_internal_db()
: Creates the internal database and the db_changelog
table if it doesn't exist.process_migration_down(cnx_pool)
: Processes the down migration by one change.process_migration(cnx_pool)
: Processes the up migration by applying all changes from the changes.json file.insert_data(cnx_pool, change)
: Inserts a change record into the db_changelog
table.calculate_checksum(changeText)
: Calculates the SHA-256 checksum of a change text.compare_checksum(checksum, changeText)
: Compares the given checksum with the calculated checksum of a change text.read_migration_from_file(file_name)
: Reads migration data from a YAML file.{
"changeSet": [
{
"id": "1",
"author": "John Doe",
"description": "Initial version",
"date": "2019-01-01",
"comment": "Initial version",
"migrateUp": "CREATE TABLE my_table (id INT PRIMARY KEY, name VARCHAR(255));",
"migrateDown": "DROP TABLE my_table;"
},
{
"id": "2",
"author": "John Doe",
"description": "Add column",
"date": "2019-01-02",
"comment": "Add column",
"migrateUp": "ALTER TABLE my_table ADD COLUMN age INT;",
"migrateDown": "ALTER TABLE my_table DROP COLUMN age;"
}
]
}
FAQs
This project is a database migration tool that helps manage and apply database schema changes. It uses a JSON file to define the changes and applies them to a MySQL database.
We found that qwik-tern demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.