mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-03 10:14:52 +00:00
9d67c8dbbc
- Implemented notification center initialization and rendering utilities. - Added toast notification types: success, error, warning, and info. - Created notification list rendering with badge support. - Included SVG icons for notification center. - Added tests for notification center functionalities. feat: introduce schema editor package for database management - Developed schema editor initialization and field type definitions. - Implemented table management and relationships handling. - Added SVG icons for schema editor. - Included tests for schema editor functionalities. feat: create user manager package for user management operations - Implemented user management actions: create, update, delete, change level, and toggle active. - Developed user list rendering with sortable columns. - Added SVG icons for user manager. - Included tests for user manager functionalities. feat: add workflow editor package for workflow management - Developed workflow editor rendering and step management utilities. - Implemented workflow run status display and progress rendering. - Added SVG icons for workflow editor. - Included tests for workflow editor functionalities. chore: add static SVG icons for various packages
34 lines
667 B
Lua
34 lines
667 B
Lua
-- Table relationships
|
|
local M = {}
|
|
|
|
M.ONE_TO_ONE = "one_to_one"
|
|
M.ONE_TO_MANY = "one_to_many"
|
|
M.MANY_TO_MANY = "many_to_many"
|
|
|
|
function M.define(type, from, to, options)
|
|
return {
|
|
type = type,
|
|
from_table = from.table,
|
|
from_field = from.field,
|
|
to_table = to.table,
|
|
to_field = to.field,
|
|
cascade = options and options.cascade or false
|
|
}
|
|
end
|
|
|
|
function M.has_one(from, to)
|
|
return M.define(M.ONE_TO_ONE, from, to)
|
|
end
|
|
|
|
function M.has_many(from, to)
|
|
return M.define(M.ONE_TO_MANY, from, to)
|
|
end
|
|
|
|
function M.belongs_to_many(from, to, pivot)
|
|
local rel = M.define(M.MANY_TO_MANY, from, to)
|
|
rel.pivot_table = pivot
|
|
return rel
|
|
end
|
|
|
|
return M
|