Postgresql Function Editor
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Completions
Snippets
images
messages
pfe_src
.gitignore
Comments.tmPreferences
Context.sublime-menu
Default (Linux).sublime-keymap
Default (OSX).sublime-keymap
Default (Windows).sublime-keymap
Default.sublime-commands
Main.sublime-menu
PostgreSQL.tmLanguage
README.md
build_pfe.sh
color.tmTheme
messages.txt
package-metadata.json
pfe-1.0.0-osx.tar.gz
postgresql_function_editor.py
postgresql_function_editor.sublime-settings
psql.json
scheme.tmLanguage
timestamp.py

README.md

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 are experiencing problems or have suggestions please file an issue.

Features

  • Creates a local temporary 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

gif

Usage

Set Database Information

  • Invoke via Ctrl+Shift+D (menu: Tools -> Postgresql Function Editor -> Set Databse Info)
  • set database option values

Sample Database Info File

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.

Saved Function

Run pgTAP Test(s)

Run 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.

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 vertical 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, or foo and foo_testing schemas as an example.

Create New Function

  • Invoke via CMD+ALT+o
  • Also visible in the tool and right-click menus.
  • 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

How to install on a Mac

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone https://github.com/danmanstx/pfe.git
  • before closing sublime add pfe to your installed 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

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 © 2015 Danny Peters, @danmanstx

Licensed under the GNU GPL license.