Skip to content

Change the base schema format #95

@patdx

Description

@patdx

Change the base schema format to reflect the database a little more closely.

We can confirm to JSON schema as required.

Additionally it should support some relations and ways to denormalize.

For example, given the following input:

{
    name: 'chats',
    columns: [
      {
        name: 'id',
        type: 'TEXT',
      },
      {
        name: 'title',
        type: 'TEXT',
      },
      {
        name: 'users',
        type: {
          type: 'array',
          item: 'TEXT',
        },
      },
    ],
  }

Perhaps we can automatically normalize (or give the user the option to normalize vs. save in a JSON blob). The normalized form would look something like this:

{
  "name": "chats",
  "columns": [
    {
      "name": "id",
      "type": "TEXT",
      "notNull": false,
      "primaryKey": false
    },
    {
      "name": "title",
      "type": "TEXT",
      "notNull": false,
      "primaryKey": false
    }
  ]
}
{
  "name": "chats_users",
  "columns": [
    {
      "name": "id",
      "type": "TEXT",
      "notNull": false,
      "primaryKey": false
    },
    {
      "name": "chats_id",
      "type": "TEXT",
      "notNull": false,
      "primaryKey": false
    },
    {
      "name": "users",
      "type": "TEXT",
      "notNull": false,
      "primaryKey": false
    }
  ]
}

On the UI side again, we may denormalize back or display in fully normal form depending on the user preference.

It should also allow to propagate some changes back to the parent, for example, bumping the updated timestamp or updating a summary field like last_message_id, etc.

  • change storage format in database
  • create EdgeSchema(?) to JSON Schema converter (to use for automatically generating forms, for now)
  • refine syntax for specifying relationships
  • decide how to track normalized vs denormalized schemas in database

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions