Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eiriksm/drush-site-schema
Get the complete picture of a site schema (updates and post updates)
https://github.com/eiriksm/drush-site-schema
composer drupal-8 drush-commands
Last synced: 2 months ago
JSON representation
Get the complete picture of a site schema (updates and post updates)
- Host: GitHub
- URL: https://github.com/eiriksm/drush-site-schema
- Owner: eiriksm
- Created: 2020-02-29T20:04:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T20:14:26.000Z (4 months ago)
- Last Synced: 2024-10-12T01:46:33.472Z (3 months ago)
- Topics: composer, drupal-8, drush-commands
- Language: PHP
- Size: 36.1 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# drush site-schema
[![Test](https://github.com/eiriksm/drush-site-schema/actions/workflows/test.yml/badge.svg)](https://github.com/eiriksm/drush-site-schema/actions/workflows/test.yml)
[![Packagist](https://img.shields.io/packagist/v/eiriksm/site-schema.svg)](https://packagist.org/packages/eiriksm/site-schema)Get the complete picture of a Drupal site schema (updates and post updates).
This can be useful to always check in the database update schema for your site, so you have a conscious relationship to what effect an update will have on your site.
As an example, if you are getting automated updates to contributed modules, maybe you want to not auto-merge and deploy the ones that contain database updates.
This command outputs a complete picture of your site, meaning the database schema version of all modules, and the post_update hooks for all modules. This way you can commit a complete picture of your site, and fail your CI if there is a difference in the file.
## Installation
Install with composer.
```
composer require eiriksm/site-schema
```## Usage
```
$ drush site-schema --help
Get the site schema for the current site.Examples:
site:schema Get the complete schema in textOptions:
--format[=FORMAT] The format to output. [default: "table"]
--fields=FIELDS Limit output to only the listed elements. Name top-level elements by key, e.g. "--fields=name,date", or use dot notation to select a nested element, e.g.
"--fields=a.b.c as example".
--field=FIELD Select just one field, and force format to 'string'.Aliases: site-schema
```## Examples
Output the entire schema
```
$ drush site-schema
------------- -------------------------------- ---------------------------------------------------------------------------
Type Module Value
------------- -------------------------------- ---------------------------------------------------------------------------
schema admin_toolbar 8001
schema admin_toolbar_tools 8000
... shortened here for convenience ...
schema views_ui 8000
post_update block_content_post_update_add_views_reusable_filter
post_update block_post_update_disable_blocks_with_missing_contexts
post_update block_post_update_disabled_region_update
post_update block_post_update_fix_negate_in_conditions
post_update comment_post_update_add_ip_address_setting
post_update comment_post_update_enable_comment_admin_view
... and so on
```Output the entire schema in json
```
$ drush site-schema --format=json
[
{
"type": "schema",
"module": "admin_toolbar",
"value": "8001"
},
{
"type": "schema",
"module": "admin_toolbar_tools",
"value": "8000"
},
... And so on.
```...or in yaml
```
$ drush site-schema --format=yaml
-
type: schema
module: admin_toolbar
value: '8001'
-
type: schema
module: admin_toolbar_tools
value: '8000'
-
# And so on.
```And then you probably want to output it to a file? Just do that!
```
$ drush site-schema --format=json > site-schema.json
```And then you can commit that file, and track your site schema with version control.
## Licence
GPL-2.0+