How to Use Phantdom
Discover How Phantdom Can Improve Your Ruby on Rails & PostgreSQL Workflow
Connecting to default is as simple as checking for the Default settings work notifier and clicking Connect Now with all form fields empty after starting up Phantdom.
Once you have connected you will be greeted with the database dashboard screen. This displays currently available databases within Phantdom. As shown in the screenshot below, databases are sorted by Rails (databases that have schema_migrations) and non-Rails datbases.
Connecting to a specific database is as easy as filling out the form presented to you when you start up Phantdom.
You will need your PostgreSQL Username, password, host (for example: localhost) and port, and finally the Database Name
Connecting to a remotely hosted database is largely the same as connecting to a locally hosted one. Simply fill out the form presented to you when you start up Phantdom with your database information.
Just like connecting to a local database, you will need your PostgreSQL Username, password, host (for this instance, it will be an IP address) and port, and finally the Database Name.
Switching databases can be done by clicking the root path shown in the top bar and selecting from the main list of currently available databases (1) or using the drop-down select menu under the Database heading in the left sidebar (2).
To view your database tables, simple click the name of the table you wish to view from either the sidebar (1) or double-click its name (2) from the main table you see by default after selecting your database.
To view the columns and table structure for your currently selected database table, simply click on the button labeled Columns in the toolbar at the bottom of the application window.
To access your Phantdom Preferences at any time, click the gear ⚙️ icon in the bottom-left of the application window.
Searching is as easy as clicking the Search input in the bottom-right corner and typing what you are looking for and Phantdom will find results as you type.
Editing table data cells is as easy as double-clicking the cell you wish to edit. Once you do, you will notice buttons to either Confirm or Cancel your changes will appear in the lower bottom-right of the application window. Clicking Confirm Changes will update and save to your database.
The INTEGER data type accepts numeric values.
The VARCHAR data type accepts character strings, including Unicode, of a variable length up to the maximum length specifiied in the data type declaration.
The TEXT data type accepts large multi-line character strings.
The TIMESTAMP data type accepts timestamp values, which are a combination of a DATE value and a TIME value. DATE and TIME data types will also be displayed with this icon.
The BOOLEAN data type accepts the storage of two values: TRUE or FALSE.
Adding the Rails app folder to its database in Phantdom can be done by clicking the folder icon highlighted in the screenshot below, navigating to the proper directory and opening the file.
The Ruby on Rails checklist, which can be accessed by clicking the button shown in the first screenshot below, is where you can go to quickly see what you need to get your Rails app running and use Rails commands. You will see what version you currently have and the path to it on your machine listed here.
Viewing the Gemfile is as easy as clicking Gemfile in the left sidebar to view a table listing out gems, along with its version number (if it has one), currently installed in your Rails app folder.
Much like viewing the Gemfile table, to open the Schema Migration table simply click the link in the left hand sidebar to view schema migrations and their status.
Open Terminal inside of Phantdom, simply click the button highlighted in the below screenshot in the top-right of the application window or you can use the tilde hotkey ~ for quick access.
Searching for new gems from rubygems.org can be done by clicking the Gems button in top-right hand of the application window, then typing in the name of the gem you are looking for. If search finds something you will then see a list of results directly beneath.
Double-clicking on any gem in the list will then take you to the Terminal window to install your selected gem.
To run rake commands inside of Phantdom, simply click the Rake button highlighted in the screenshot below and choose the command you wish to run.
You can create new database migrations by clicking the New Migration button highlighted in the screenshot below, filling out the information you desire (depending on the type of migration you choose) for your new migration and then clicking Run Migration when you are finished.
Once you have completed your migration, you will want to run the db:migrate command. To do this, click on the Rake button and select the command from the drop-down menu.
When viewing the schema_migrations table, look to the Status column to see what method of migration it is. A status of up is for transformations to your schema, such as adding new tables and/or columns, and a status of down is for reverting previous transformations done with up-status migrations.
Let us know in the comments