Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the base schema format #95

Open
4 tasks
patdx opened this issue Mar 23, 2023 · 0 comments
Open
4 tasks

Change the base schema format #95

patdx opened this issue Mar 23, 2023 · 0 comments

Comments

@patdx
Copy link
Owner

patdx commented Mar 23, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant