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

Maintain database representations of reports & scripts #14438

Closed
jeremystretch opened this issue Dec 5, 2023 · 1 comment · Fixed by #15061
Closed

Maintain database representations of reports & scripts #14438

jeremystretch opened this issue Dec 5, 2023 · 1 comment · Fixed by #15061
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@jeremystretch
Copy link
Member

NetBox version

v3.6.6

Feature type

Data model extension

Proposed functionality

Promote the "dummy" models in the extras that currently represent reports and scripts to "real" models corresponding to database tables. Each Report or Script instance will correlate to a Python class belonging to a ReportModule or ScriptModule, respectively. Report and Script objects will be created, updated, and deleted automatically in response to content changes in their assigned module.

Use case

The lack of a concrete database object representing individual reports and scripts limits our ability to efficiently represent relationships with other NetBox objects. Two prime examples are:

Essentially, we reduce the current need for a tuple of (module, class) to a simple ForeignKey relationship.

Database changes

Promoting the Report and Script classes to concrete models will effect the creation of two new PostgreSQL tables:

  • extras_report
  • extras_script

One new database record will be automatically created for each report and script currently installed.

External dependencies

None

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Dec 5, 2023
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Jan 11, 2024
@jeremystretch jeremystretch added this to the v4.0 milestone Jan 11, 2024
@arthanson arthanson self-assigned this Jan 17, 2024
@eronlloyd
Copy link

Will this allow scripts to be persistent through replacement? It would be nice not to have to delete them each time a script is updated, although I understand how that could create issues if allowed unchecked.

jeremystretch added a commit that referenced this issue Feb 23, 2024
- Introduces the Script model to represent individual Python classes within a ScriptModule file
- Automatically migrates jobs & event rules

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants