IHP Api Reference
Copyright(c) digitally induced GmbH 2021
Safe HaskellNone

IHP.IDE.SchemaDesigner.SchemaOperations

Description

 
Synopsis

Documentation

type Schema = [Statement] Source #

A Schema.sql basically is just a list of sql DDL statements

addTable :: Text -> Schema -> Schema Source #

Creates a new tables with a id columns as the primary key

addEnum :: Text -> Schema -> Schema Source #

An enum is added after all existing enum statements, but right before CREATE TABLE statements

data UpdatePolicyOptions Source #

Constructors

UpdatePolicyOptions 

Fields

suggestPolicy :: Statement -> Statement Source #

Checks if there exists a user_id column, and returns a policy based on that. If there's no user_id field on the table it will return an empty policy

TODO: In the future this function should follow foreign keys to find the shortest path to a user_id. E.g. when having a schema post_meta_tags (no user_id column) - posts (has a user_id) - users:

                                                post_id
                           posts_meta_infos ────────────────►  posts
                                                                │
                                                                │
                                                                │
                                                                │
                                                                │
                                                                │ user_id
                                                                │
                                                                │
                                                                │
                                                                │
                                         users  ◄───────────────┘