Coder Social home page Coder Social logo

dbforgetool's Introduction

DBForge Tool

A simple tool built to help make field arrays for use in DBForge, on CodeIgniter projects.

DBForge Tool is a NW.js based tool built to help create table arrays to be used with the database forge (dbforge) module on CodeIgniter. In essence, it just helps you build the fields array used when creating a table.

The reason I built this tool is because some code started to become really massive on some models to me (specially when I was using more than 4 tables), so I wanted a solution that would lessen the number of lines in the code and, also, let me backup all the table layouts into files (so I could just copy/paste'em, load and rebuild the tables whenever I wanted).

Bear in mind that I'm not a great coder, and this is just a simple tool built to my own needs, so things might require some extra coding for other solutions. The source code is commented as much as possible, but I might have left some things uncommented.

Use this at your own risk! ๐Ÿ˜…๐Ÿ’ฆ


How To

You should use the binary release or run the source code with NW.js/Node Webkit. You can just run this as a web app, but you won't be able to save the generated data in a file.

When opening the app, you're presented with this screen:

Screen Description
Screen 01 When you open the application, you're presented with this screen. Clicking on the "?" button opens the "About" panel.
Screen 02 Clicking on the "Add Field" button, adds a single field entity for the database, every field starts minimized. You can click on the field's name and drag it to sort them (recommended doing it with the field minimized), the "X" button to delete the field or expand the field to fill the details on it.
The field name and type are always required, but the other fields aren't, so you can just delete'em if you want (you can't add'em later, so carefully think about it, as you'll have to add another field).
Screen 03 After filling the field data, you can click on the "Generate" button, which brings you to this screen. You can save the generated JSON data as a file (just a simple text file with the "dbforge" extension) and you can also click on the textarea to select everything and copy it.

After you've generated the code, this is an example implementation of what you can do with it:

// Reading the content
$file = file_get_contents( "data.dbforge" );

// Decode the JSON into an associative array
$file = json_decode( $file, true );

By doing this, you'll have an array containing some nested arrays and values. Each array has:

  • 'title': a string containing the field name;
  • 'value': an associative array with the field data values;

Example CodeIgniter Model

I've written a simple Gist, containing a dummy model to exemplify how you'd use this class, you can find it here: https://gist.github.com/yuigoto/f87acc9bea12d0a1a827072f0e1bbb15


Authors

See AUTHORS.md for more information.


License

This project is licensed under the MIT License. See LICENSE.md for more details on the subjects of the license.


ยฉ2016-2020 Fabio Y. Goto

dbforgetool's People

Contributors

yuigoto avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.