Home | Forum | Documentation

Code Stylist Documentation





Home | Docs | Entry 4



make a new database table

Make a new database table
Now that you are connected to a database you can use codestylist to manage, modify, and create tables in your database.

  1. From the menu choose Tools >> Create Table.
  2. Enter the name of a new table, making sure the name is plural. The names of tables created or managed with codestylist must end with an s. This enables your database web application to provide a semantically consistent RESTful API. (see more on table naming, below). Click the Next button.

Add fields to your new table

  1. Enter a field name
  2. Choose a data type from the drop down menu.
  3. Enter a modifier (optional)
  4. Click the plus button.
  5. Repeat. When you have finished adding fields, click Next.
  6. TIP: The first field, id, has been added automatically. This field is necessary for all tables managed or created by Code Stylist.

Verify your new table.

  1. If all of the fields look correct, click Next.
  2. Select a primary key. If you're not sure what this is, just leave it as the default, id. Click Next.

Set permissions for your new table.

  1. Select a table in the list window.
  2. Type the name of the group (link) you would like to allow (exactly) access to the table, and check the appropriate boxes.
  3. Finally, click the "Publish" button to transmit the updated data model to the Web server. You are now ready to create a web page to interact with this table. A good place to start is an HTML input form.


TIP: Email notification of table updates is built into Code Stylist sites. By default, each new table is automatically set to allow access to the administrators group. Therefore, each time your new table is updated, members of the administrators group (such as yourself) will receive an email notification.

TIP: How do I create or manage groups?

TIP: Cloning: By cloning tables, you can create "private" Web site areas with access limited to specific Groups.  Bri: what does this mean?

  1. To clone a table, choose Tools >> Create Table from the main menu. Check the clone checkbox, and select a Table to Clone from the drop down menu.
  2. Click the "Clone" checkbox and choose a table from the list if you simply want another table similar to one you already have.


TIP:
Table Naming: We sometimes refer to a database table as a "collection" because tables are required to have a plural name. This requirement is rooted in the "resource-oriented" architecture employed in a Code Stylist application, and it enables your application to provide a semantically consistent RESTful API.

TIP: By default, Code Stylist will create a number of tables in your database. These are useful and good because they are derived from emergent standards such as Microformats, Vcard, Ical, etc. You can choose to work with these tables my modifying or cloning them, or you can create new ones.









Sign In to post comments







Bookmark this page:








Sign In



Click here to become a member. It's free and convenient.