Postgresql Function Editor - Sublime Plugin
Plugin for Sublime Text 3 that helps you work directly with postgresql database functions and run pgTAP tests. Trello board
Warning: If you experience problems or have suggestions please file an issue.
Features
- Creates a local copy of all database functions from a specified database.
- Save a Function to the database with output.
- Ability to Run a pgTAP test, or all open test files.
- Pgplsql highlighting, and pgTAP output panel highlighting.
- Quick Switch between file and test with CMD+..
- Quick Create new plpgsql functions with CMD+ALT+o.
- Common Completions and Snippets for
plpgsql
files
Usage
Set Database Information
- Invoke via Ctrl+Shift+D (menu:
Tools
->Postgresql Function Editor
->Set Databse Info
) - set database option values
Load Database functions
- Invoke via F1 or
Tools
->Postgresql Function Editor
->Load Database Functions
- Loads the database functions in the side bar seperated by folders which one for each schema.
Save a Function to The Database
- Invoke via F2 or
Tools
->Postgresql Function Editor
->Save Database Function
- Saves the function to the database and opens a panel with the command output.
pgTAP Test(s)
RunRun test in active tab
- Invoke via F3 or
Tools
->Postgresql Function Editor
->Run pgTAP Test
- Saves the function to the database and opens a panel with the test output.
Run all opened tests
- Invoke via F4 or
Tools
->Postgresql Function Editor
->Run All Opened Tests
- Saves the active function to the database and opens a panel with the test output for all open test.
Quick Switch/Create File
- Invoke via CMD+. or CMD+Ctrl+. for same pane split.
- Attempts to switch to or create the alternating file/test based on the schema and function name.
- this expects either a
public
/testing
schema, orfoo
andfoo_testing
schemas as an example.
Create New Function
- Invoke via CMD+ALT+o
- Brings up a list of schemas, and then allows you to specify the exact function you would like. Then use F2 to save this function into the current database.
Dependencies
- Sublime Text 3 and Package Manager,
- pgTAP for pgTAP testing
How to install on a Mac
- install package manager
- clone repo for pfe in packages directory
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone https://github.com/danmanstx/pfe.git
- before closing sublime add
pfe
to yourinstalled packages
located here:
Sublime text --> Preferences --> Package Settings --> Package Control --> Settings - User
COMING SOON install with Package Control
Options
Sample options below.
Go to Preferences
-> Package Settings
-> Postgresql Function Editor
->Settings - User
and add this to the file or copy and edit from Settings - Default
:
{
"function_folder": "/tmp/postgresFunctions",
"host": "localhost",
"database": "database",
"user": "postgresql",
"port": "5432",
}
Changelog
v1.0.0
- Initial release
Acknowledgments
- Inspired by Suran Systems Textmate Postgresql Bundle.
- Quick Switching Inspired by Ruby Test.
- Quick File Creation Inspired By Sublime Quick File Creator
- No more ruby or gems! Thanks to Traveling Ruby
Roadmap
- Add more plpgsql Snippets for better autocompletion.
- Add ability to save recently used databases.
- Add linux/Windows Traveling Ruby Packages.
- Creation of atom plugin because sublime's future is uncertain.
Copyright and license
Copyright © 2014 Danny Peters, @danmanstx
Licensed under the GNU GPL license.