# migration_log

migration_id: create migration_log table
timestamp: 2023-02-13 17:35:32
sql:
  CREATE TABLE IF NOT EXISTS `migration_log` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `migration_id` TEXT NOT NULL
  , `sql` TEXT NOT NULL
  , `success` INTEGER NOT NULL
  , `error` TEXT NOT NULL
  , `timestamp` DATETIME NOT NULL
  );


migration_id: create user table
timestamp: 2023-02-13 17:35:32
sql:
  CREATE TABLE IF NOT EXISTS `user` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `login` TEXT NOT NULL
  , `email` TEXT NOT NULL
  , `name` TEXT NULL
  , `password` TEXT NULL
  , `salt` TEXT NULL
  , `rands` TEXT NULL
  , `company` TEXT NULL
  , `account_id` INTEGER NOT NULL
  , `is_admin` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create user table v2
timestamp: 2023-02-13 17:35:33
sql:
  CREATE TABLE IF NOT EXISTS `user` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `login` TEXT NOT NULL
  , `email` TEXT NOT NULL
  , `name` TEXT NULL
  , `password` TEXT NULL
  , `salt` TEXT NULL
  , `rands` TEXT NULL
  , `company` TEXT NULL
  , `org_id` INTEGER NOT NULL
  , `is_admin` INTEGER NOT NULL
  , `email_verified` INTEGER NULL
  , `theme` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: copy data_source v1 to v2
timestamp: 2023-02-13 17:35:33
sql:
  INSERT INTO `user` (`version`
  , `company`
  , `updated`
  , `org_id`
  , `id`
  , `login`
  , `email`
  , `name`
  , `password`
  , `salt`
  , `rands`
  , `is_admin`
  , `created`) SELECT `version`
  , `company`
  , `updated`
  , `account_id`
  , `id`
  , `login`
  , `email`
  , `name`
  , `password`
  , `salt`
  , `rands`
  , `is_admin`
  , `created` FROM `user_v1`


migration_id: Update is_service_account column to nullable
timestamp: 2023-02-13 17:35:33
sql:
  ALTER TABLE user ADD COLUMN tmp_service_account BOOLEAN DEFAULT 0;
  UPDATE user SET tmp_service_account = is_service_account;
  ALTER TABLE user DROP COLUMN is_service_account;
  ALTER TABLE user RENAME COLUMN tmp_service_account TO is_service_account;


migration_id: create temp user table v1-7
timestamp: 2023-02-13 17:35:33
sql:
  CREATE TABLE IF NOT EXISTS `temp_user` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `email` TEXT NOT NULL
  , `name` TEXT NULL
  , `role` TEXT NULL
  , `code` TEXT NOT NULL
  , `status` TEXT NOT NULL
  , `invited_by_user_id` INTEGER NULL
  , `email_sent` INTEGER NOT NULL
  , `email_sent_on` DATETIME NULL
  , `remote_addr` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create temp_user v2
timestamp: 2023-02-13 17:35:34
sql:
  CREATE TABLE IF NOT EXISTS `temp_user` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `email` TEXT NOT NULL
  , `name` TEXT NULL
  , `role` TEXT NULL
  , `code` TEXT NOT NULL
  , `status` TEXT NOT NULL
  , `invited_by_user_id` INTEGER NULL
  , `email_sent` INTEGER NOT NULL
  , `email_sent_on` DATETIME NULL
  , `remote_addr` TEXT NULL
  , `created` INTEGER NOT NULL DEFAULT 0
  , `updated` INTEGER NOT NULL DEFAULT 0
  );


migration_id: copy temp_user v1 to v2
timestamp: 2023-02-13 17:35:34
sql:
  INSERT INTO `temp_user` (`status`
  , `email_sent`
  , `id`
  , `role`
  , `email`
  , `name`
  , `code`
  , `invited_by_user_id`
  , `email_sent_on`
  , `remote_addr`
  , `org_id`
  , `version`) SELECT `status`
  , `email_sent`
  , `id`
  , `role`
  , `email`
  , `name`
  , `code`
  , `invited_by_user_id`
  , `email_sent_on`
  , `remote_addr`
  , `org_id`
  , `version` FROM `temp_user_tmp_qwerty`


migration_id: create star table
timestamp: 2023-02-13 17:35:34
sql:
  CREATE TABLE IF NOT EXISTS `star` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `user_id` INTEGER NOT NULL
  , `dashboard_id` INTEGER NOT NULL
  );


migration_id: create org table v1
timestamp: 2023-02-13 17:35:34
sql:
  CREATE TABLE IF NOT EXISTS `org` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `name` TEXT NOT NULL
  , `address1` TEXT NULL
  , `address2` TEXT NULL
  , `city` TEXT NULL
  , `state` TEXT NULL
  , `zip_code` TEXT NULL
  , `country` TEXT NULL
  , `billing_email` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create org_user table v1
timestamp: 2023-02-13 17:35:34
sql:
  CREATE TABLE IF NOT EXISTS `org_user` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `user_id` INTEGER NOT NULL
  , `role` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create dashboard table
timestamp: 2023-02-13 17:35:35
sql:
  CREATE TABLE IF NOT EXISTS `dashboard` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `slug` TEXT NOT NULL
  , `title` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `account_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create dashboard_tag table
timestamp: 2023-02-13 17:35:35
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_tag` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `dashboard_id` INTEGER NOT NULL
  , `term` TEXT NOT NULL
  );


migration_id: add unique index dashboard_tag.dasboard_id_term
timestamp: 2023-02-13 17:35:35
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_tag_dashboard_id_term` ON `dashboard_tag` (`dashboard_id`,`term`);


migration_id: create dashboard v2
timestamp: 2023-02-13 17:35:35
sql:
  CREATE TABLE IF NOT EXISTS `dashboard` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `slug` TEXT NOT NULL
  , `title` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: copy dashboard v1 to v2
timestamp: 2023-02-13 17:35:35
sql:
  INSERT INTO `dashboard` (`data`
  , `org_id`
  , `created`
  , `updated`
  , `id`
  , `version`
  , `slug`
  , `title`) SELECT `data`
  , `account_id`
  , `created`
  , `updated`
  , `id`
  , `version`
  , `slug`
  , `title` FROM `dashboard_v1`


migration_id: Add unique index for dashboard_org_id_title_folder_id
timestamp: 2023-02-13 17:35:36
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_org_id_folder_id_title` ON `dashboard` (`org_id`,`folder_id`,`title`);


migration_id: create dashboard_provisioning
timestamp: 2023-02-13 17:35:36
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_provisioning` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `dashboard_id` INTEGER NULL
  , `name` TEXT NOT NULL
  , `external_id` TEXT NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create dashboard_provisioning v2
timestamp: 2023-02-13 17:35:36
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_provisioning` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `dashboard_id` INTEGER NULL
  , `name` TEXT NOT NULL
  , `external_id` TEXT NOT NULL
  , `updated` INTEGER NOT NULL DEFAULT 0
  );


migration_id: create index IDX_dashboard_provisioning_dashboard_id - v2
timestamp: 2023-02-13 17:35:36
sql:
  CREATE INDEX `IDX_dashboard_provisioning_dashboard_id` ON `dashboard_provisioning` (`dashboard_id`);


migration_id: create index IDX_dashboard_provisioning_dashboard_id_name - v2
timestamp: 2023-02-13 17:35:36
sql:
  CREATE INDEX `IDX_dashboard_provisioning_dashboard_id_name` ON `dashboard_provisioning` (`dashboard_id`,`name`);


migration_id: copy dashboard_provisioning v1 to v2
timestamp: 2023-02-13 17:35:36
sql:
  INSERT INTO `dashboard_provisioning` (`id`
  , `dashboard_id`
  , `name`
  , `external_id`) SELECT `id`
  , `dashboard_id`
  , `name`
  , `external_id` FROM `dashboard_provisioning_tmp_qwerty`


migration_id: create data_source table
timestamp: 2023-02-13 17:35:36
sql:
  CREATE TABLE IF NOT EXISTS `data_source` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `account_id` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `type` TEXT NOT NULL
  , `name` TEXT NOT NULL
  , `access` TEXT NOT NULL
  , `url` TEXT NOT NULL
  , `password` TEXT NULL
  , `user` TEXT NULL
  , `database` TEXT NULL
  , `basic_auth` INTEGER NOT NULL
  , `basic_auth_user` TEXT NULL
  , `basic_auth_password` TEXT NULL
  , `is_default` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create data_source table v2
timestamp: 2023-02-13 17:35:37
sql:
  CREATE TABLE IF NOT EXISTS `data_source` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `type` TEXT NOT NULL
  , `name` TEXT NOT NULL
  , `access` TEXT NOT NULL
  , `url` TEXT NOT NULL
  , `password` TEXT NULL
  , `user` TEXT NULL
  , `database` TEXT NULL
  , `basic_auth` INTEGER NOT NULL
  , `basic_auth_user` TEXT NULL
  , `basic_auth_password` TEXT NULL
  , `is_default` INTEGER NOT NULL
  , `json_data` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create api_key table
timestamp: 2023-02-13 17:35:37
sql:
  CREATE TABLE IF NOT EXISTS `api_key` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `account_id` INTEGER NOT NULL
  , `name` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `role` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create api_key table v2
timestamp: 2023-02-13 17:35:37
sql:
  CREATE TABLE IF NOT EXISTS `api_key` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `name` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `role` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: copy api_key v1 to v2
timestamp: 2023-02-13 17:35:38
sql:
  INSERT INTO `api_key` (`role`
  , `created`
  , `updated`
  , `id`
  , `org_id`
  , `name`
  , `key`) SELECT `role`
  , `created`
  , `updated`
  , `id`
  , `account_id`
  , `name`
  , `key` FROM `api_key_v1`


migration_id: create dashboard_snapshot table v4
timestamp: 2023-02-13 17:35:38
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_snapshot` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `name` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `dashboard` TEXT NOT NULL
  , `expires` DATETIME NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create dashboard_snapshot table v5 #2
timestamp: 2023-02-13 17:35:38
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_snapshot` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `name` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `delete_key` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `user_id` INTEGER NOT NULL
  , `external` INTEGER NOT NULL
  , `external_url` TEXT NOT NULL
  , `dashboard` TEXT NOT NULL
  , `expires` DATETIME NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create quota table v1
timestamp: 2023-02-13 17:35:38
sql:
  CREATE TABLE IF NOT EXISTS `quota` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NULL
  , `user_id` INTEGER NULL
  , `target` TEXT NOT NULL
  , `limit` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create plugin_setting table
timestamp: 2023-02-13 17:35:38
sql:
  CREATE TABLE IF NOT EXISTS `plugin_setting` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NULL
  , `plugin_id` TEXT NOT NULL
  , `enabled` INTEGER NOT NULL
  , `pinned` INTEGER NOT NULL
  , `json_data` TEXT NULL
  , `secure_json_data` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create index UQE_plugin_setting_org_id_plugin_id - v1
timestamp: 2023-02-13 17:35:38
sql:
  CREATE UNIQUE INDEX `UQE_plugin_setting_org_id_plugin_id` ON `plugin_setting` (`org_id`,`plugin_id`);


migration_id: create session table
timestamp: 2023-02-13 17:35:38
sql:
  CREATE TABLE IF NOT EXISTS `session` (
  `key` TEXT PRIMARY KEY NOT NULL
  , `data` BLOB NOT NULL
  , `expiry` INTEGER NOT NULL
  );


migration_id: create playlist table v2
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `playlist` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `name` TEXT NOT NULL
  , `interval` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  );


migration_id: create playlist item table v2
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `playlist_item` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `playlist_id` INTEGER NOT NULL
  , `type` TEXT NOT NULL
  , `value` TEXT NOT NULL
  , `title` TEXT NOT NULL
  , `order` INTEGER NOT NULL
  );


migration_id: create preferences table v3
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `preferences` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `user_id` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `home_dashboard_id` INTEGER NOT NULL
  , `timezone` TEXT NOT NULL
  , `theme` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create alert table v1
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `alert` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `version` INTEGER NOT NULL
  , `dashboard_id` INTEGER NOT NULL
  , `panel_id` INTEGER NOT NULL
  , `org_id` INTEGER NOT NULL
  , `name` TEXT NOT NULL
  , `message` TEXT NOT NULL
  , `state` TEXT NOT NULL
  , `settings` TEXT NOT NULL
  , `frequency` INTEGER NOT NULL
  , `handler` INTEGER NOT NULL
  , `severity` TEXT NOT NULL
  , `silenced` INTEGER NOT NULL
  , `execution_error` TEXT NOT NULL
  , `eval_data` TEXT NULL
  , `eval_date` DATETIME NULL
  , `new_state_date` DATETIME NOT NULL
  , `state_changes` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: Create alert_rule_tag table v1
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `alert_rule_tag` (
  `alert_id` INTEGER NOT NULL
  , `tag_id` INTEGER NOT NULL
  );


migration_id: Create alert_rule_tag table v2
timestamp: 2023-02-13 17:35:39
sql:
  CREATE TABLE IF NOT EXISTS `alert_rule_tag` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `alert_id` INTEGER NOT NULL
  , `tag_id` INTEGER NOT NULL
  );


sql: CREATE UNIQUE INDEX `UQE_alert_rule_tag_alert_id_tag_id` ON `alert_rule_tag` (`alert_id`,`tag_id`);
timestamp: 2023-02-13 17:35:40
migration_id:
  create index UQE_alert_rule_tag_alert_id_tag_id - Add unique index alert_rule_tag.alert_id_tag_id V2


migration_id: copy alert_rule_tag v1 to v2
timestamp: 2023-02-13 17:35:40
sql:
  INSERT INTO `alert_rule_tag` (`alert_id`
  , `tag_id`) SELECT `alert_id`
  , `tag_id` FROM `alert_rule_tag_v1`


migration_id: create alert_notification table v1
timestamp: 2023-02-13 17:35:40
sql:
  CREATE TABLE IF NOT EXISTS `alert_notification` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `name` TEXT NOT NULL
  , `type` TEXT NOT NULL
  , `settings` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create notification_journal table v1
timestamp: 2023-02-13 17:35:40
sql:
  CREATE TABLE IF NOT EXISTS `alert_notification_journal` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `alert_id` INTEGER NOT NULL
  , `notifier_id` INTEGER NOT NULL
  , `sent_at` INTEGER NOT NULL
  , `success` INTEGER NOT NULL
  );


migration_id: add index notification_journal org_id & alert_id & notifier_id
timestamp: 2023-02-13 17:35:40
sql:
  CREATE INDEX `IDX_alert_notification_journal_org_id_alert_id_notifier_id` ON `alert_notification_journal` (`org_id`,`alert_id`,`notifier_id`);


migration_id: create alert_notification_state table v1
timestamp: 2023-02-13 17:35:40
sql:
  CREATE TABLE IF NOT EXISTS `alert_notification_state` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `alert_id` INTEGER NOT NULL
  , `notifier_id` INTEGER NOT NULL
  , `state` TEXT NOT NULL
  , `version` INTEGER NOT NULL
  , `updated_at` INTEGER NOT NULL
  , `alert_rule_state_updated_version` INTEGER NOT NULL
  );


migration_id: add index alert_notification_state org_id & alert_id & notifier_id
timestamp: 2023-02-13 17:35:40
sql:
  CREATE UNIQUE INDEX `UQE_alert_notification_state_org_id_alert_id_notifier_id` ON `alert_notification_state` (`org_id`,`alert_id`,`notifier_id`);


migration_id: create annotation table v5
timestamp: 2023-02-13 17:35:40
sql:
  CREATE TABLE IF NOT EXISTS `annotation` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `alert_id` INTEGER NULL
  , `user_id` INTEGER NULL
  , `dashboard_id` INTEGER NULL
  , `panel_id` INTEGER NULL
  , `category_id` INTEGER NULL
  , `type` TEXT NOT NULL
  , `title` TEXT NOT NULL
  , `text` TEXT NOT NULL
  , `metric` TEXT NULL
  , `prev_state` TEXT NOT NULL
  , `new_state` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `epoch` INTEGER NOT NULL
  );


migration_id: add index annotation 3 v3
timestamp: 2023-02-13 17:35:41
sql:
  CREATE INDEX `IDX_annotation_org_id_dashboard_id_panel_id_epoch` ON `annotation` (`org_id`,`dashboard_id`,`panel_id`,`epoch`);


migration_id: Create annotation_tag table v2
timestamp: 2023-02-13 17:35:41
sql:
  CREATE TABLE IF NOT EXISTS `annotation_tag` (
  `annotation_id` INTEGER NOT NULL
  , `tag_id` INTEGER NOT NULL
  );


migration_id: Add unique index annotation_tag.annotation_id_tag_id
timestamp: 2023-02-13 17:35:41
sql:
  CREATE UNIQUE INDEX `UQE_annotation_tag_annotation_id_tag_id` ON `annotation_tag` (`annotation_id`,`tag_id`);


migration_id: Create annotation_tag table v3
timestamp: 2023-02-13 17:35:41
sql:
  CREATE TABLE IF NOT EXISTS `annotation_tag` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `annotation_id` INTEGER NOT NULL
  , `tag_id` INTEGER NOT NULL
  );


timestamp: 2023-02-13 17:35:41
migration_id:
  create index UQE_annotation_tag_annotation_id_tag_id - Add unique index annotation_tag.annotation_id_tag_id V3

sql:
  CREATE UNIQUE INDEX `UQE_annotation_tag_annotation_id_tag_id` ON `annotation_tag` (`annotation_id`,`tag_id`);


migration_id: copy annotation_tag v2 to v3
timestamp: 2023-02-13 17:35:41
sql:
  INSERT INTO `annotation_tag` (`annotation_id`
  , `tag_id`) SELECT `annotation_id`
  , `tag_id` FROM `annotation_tag_v2`


migration_id: Add index for epoch_end
timestamp: 2023-02-13 17:35:41
sql:
  CREATE INDEX `IDX_annotation_org_id_epoch_epoch_end` ON `annotation` (`org_id`,`epoch`,`epoch_end`);


migration_id: Add index for org_id_dashboard_id_epoch_end_epoch on annotation table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE INDEX `IDX_annotation_org_id_dashboard_id_epoch_end_epoch` ON `annotation` (`org_id`,`dashboard_id`,`epoch_end`,`epoch`);


migration_id: Add index for org_id_epoch_end_epoch on annotation table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE INDEX `IDX_annotation_org_id_epoch_end_epoch` ON `annotation` (`org_id`,`epoch_end`,`epoch`);


migration_id: create test_data table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE TABLE IF NOT EXISTS `test_data` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `metric1` TEXT NULL
  , `metric2` TEXT NULL
  , `value_big_int` INTEGER NULL
  , `value_double` REAL NULL
  , `value_float` REAL NULL
  , `value_int` INTEGER NULL
  , `time_epoch` INTEGER NOT NULL
  , `time_date_time` DATETIME NOT NULL
  , `time_time_stamp` DATETIME NOT NULL
  );


migration_id: create dashboard_version table v1
timestamp: 2023-02-13 17:35:42
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_version` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `dashboard_id` INTEGER NOT NULL
  , `parent_version` INTEGER NOT NULL
  , `restored_from` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `created_by` INTEGER NOT NULL
  , `message` TEXT NOT NULL
  , `data` TEXT NOT NULL
  );


migration_id: add unique index dashboard_version.dashboard_id and dashboard_version.version
timestamp: 2023-02-13 17:35:42
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_version_dashboard_id_version` ON `dashboard_version` (`dashboard_id`,`version`);


migration_id: save existing dashboard data in dashboard_version table v1
timestamp: 2023-02-13 17:35:42
sql:
  INSERT INTO dashboard_version
  (
  	dashboard_id,
  	version,
  	parent_version,
  	restored_from,
  	created,
  	created_by,
  	message,
  	data
  )
  SELECT
  	dashboard.id,
  	dashboard.version,
  	dashboard.version,
  	dashboard.version,
  	dashboard.updated,
  	COALESCE(dashboard.updated_by, -1),
  	'',
  	dashboard.data
  FROM dashboard;


migration_id: create team table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE TABLE IF NOT EXISTS `team` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `name` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create team member table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE TABLE IF NOT EXISTS `team_member` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `team_id` INTEGER NOT NULL
  , `user_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: add unique index team_member_org_id_team_id_user_id
timestamp: 2023-02-13 17:35:42
sql:
  CREATE UNIQUE INDEX `UQE_team_member_org_id_team_id_user_id` ON `team_member` (`org_id`,`team_id`,`user_id`);


migration_id: create dashboard acl table
timestamp: 2023-02-13 17:35:42
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_acl` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `dashboard_id` INTEGER NOT NULL
  , `user_id` INTEGER NULL
  , `team_id` INTEGER NULL
  , `permission` INTEGER NOT NULL DEFAULT 4
  , `role` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: add unique index dashboard_acl_dashboard_id_user_id
timestamp: 2023-02-13 17:35:43
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_acl_dashboard_id_user_id` ON `dashboard_acl` (`dashboard_id`,`user_id`);


migration_id: add unique index dashboard_acl_dashboard_id_team_id
timestamp: 2023-02-13 17:35:43
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_acl_dashboard_id_team_id` ON `dashboard_acl` (`dashboard_id`,`team_id`);


migration_id: save default acl rules in dashboard_acl table
timestamp: 2023-02-13 17:35:43
sql:
  INSERT INTO dashboard_acl
  	(
  		org_id,
  		dashboard_id,
  		permission,
  		role,
  		created,
  		updated
  	)
  	VALUES
  		(-1,-1, 1,'Viewer','2017-06-20','2017-06-20'),
  		(-1,-1, 2,'Editor','2017-06-20','2017-06-20')
  	


migration_id: delete acl rules for deleted dashboards and folders
timestamp: 2023-02-13 17:35:43
sql:
  DELETE FROM dashboard_acl WHERE dashboard_id NOT IN (SELECT id FROM dashboard) AND dashboard_id != -1


migration_id: create tag table
timestamp: 2023-02-13 17:35:43
sql:
  CREATE TABLE IF NOT EXISTS `tag` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `key` TEXT NOT NULL
  , `value` TEXT NOT NULL
  );


migration_id: create login attempt table
timestamp: 2023-02-13 17:35:43
sql:
  CREATE TABLE IF NOT EXISTS `login_attempt` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `username` TEXT NOT NULL
  , `ip_address` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  );


migration_id: create login_attempt v2
timestamp: 2023-02-13 17:35:43
sql:
  CREATE TABLE IF NOT EXISTS `login_attempt` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `username` TEXT NOT NULL
  , `ip_address` TEXT NOT NULL
  , `created` INTEGER NOT NULL DEFAULT 0
  );


migration_id: copy login_attempt v1 to v2
timestamp: 2023-02-13 17:35:43
sql:
  INSERT INTO `login_attempt` (`id`
  , `username`
  , `ip_address`) SELECT `id`
  , `username`
  , `ip_address` FROM `login_attempt_tmp_qwerty`


migration_id: create user auth table
timestamp: 2023-02-13 17:35:43
sql:
  CREATE TABLE IF NOT EXISTS `user_auth` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `user_id` INTEGER NOT NULL
  , `auth_module` TEXT NOT NULL
  , `auth_id` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  );


migration_id: create server_lock table
timestamp: 2023-02-13 17:35:44
sql:
  CREATE TABLE IF NOT EXISTS `server_lock` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `operation_uid` TEXT NOT NULL
  , `version` INTEGER NOT NULL
  , `last_execution` INTEGER NOT NULL
  );


migration_id: create user auth token table
timestamp: 2023-02-13 17:35:44
sql:
  CREATE TABLE IF NOT EXISTS `user_auth_token` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `user_id` INTEGER NOT NULL
  , `auth_token` TEXT NOT NULL
  , `prev_auth_token` TEXT NOT NULL
  , `user_agent` TEXT NOT NULL
  , `client_ip` TEXT NOT NULL
  , `auth_token_seen` INTEGER NOT NULL
  , `seen_at` INTEGER NULL
  , `rotated_at` INTEGER NOT NULL
  , `created_at` INTEGER NOT NULL
  , `updated_at` INTEGER NOT NULL
  );


migration_id: create cache_data table
timestamp: 2023-02-13 17:35:44
sql:
  CREATE TABLE IF NOT EXISTS `cache_data` (
  `cache_key` TEXT PRIMARY KEY NOT NULL
  , `data` BLOB NOT NULL
  , `expires` INTEGER NOT NULL
  , `created_at` INTEGER NOT NULL
  );


migration_id: create short_url table v1
timestamp: 2023-02-13 17:35:44
sql:
  CREATE TABLE IF NOT EXISTS `short_url` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `uid` TEXT NOT NULL
  , `path` TEXT NOT NULL
  , `created_by` INTEGER NOT NULL
  , `created_at` INTEGER NOT NULL
  , `last_seen_at` INTEGER NULL
  );


migration_id: recreate alert_definition table
timestamp: 2023-02-13 17:35:44
sql:
  CREATE TABLE IF NOT EXISTS `alert_definition` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `title` TEXT NOT NULL
  , `condition` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `updated` DATETIME NOT NULL
  , `interval_seconds` INTEGER NOT NULL DEFAULT 60
  , `version` INTEGER NOT NULL DEFAULT 0
  , `uid` TEXT NOT NULL DEFAULT 0
  );


migration_id: recreate alert_definition_version table
timestamp: 2023-02-13 17:35:45
sql:
  CREATE TABLE IF NOT EXISTS `alert_definition_version` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `alert_definition_id` INTEGER NOT NULL
  , `alert_definition_uid` TEXT NOT NULL DEFAULT 0
  , `parent_version` INTEGER NOT NULL
  , `restored_from` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `title` TEXT NOT NULL
  , `condition` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `interval_seconds` INTEGER NOT NULL
  );


migration_id: add index in alert_definition_version table on alert_definition_id and version columns
timestamp: 2023-02-13 17:35:45
sql:
  CREATE UNIQUE INDEX `UQE_alert_definition_version_alert_definition_id_version` ON `alert_definition_version` (`alert_definition_id`,`version`);


migration_id: add index in alert_definition_version table on alert_definition_uid and version columns
timestamp: 2023-02-13 17:35:45
sql:
  CREATE UNIQUE INDEX `UQE_alert_definition_version_alert_definition_uid_version` ON `alert_definition_version` (`alert_definition_uid`,`version`);


migration_id: create alert_instance table
timestamp: 2023-02-13 17:35:45
sql:
  CREATE TABLE IF NOT EXISTS `alert_instance` (
  `def_org_id` INTEGER NOT NULL
  , `def_uid` TEXT NOT NULL DEFAULT 0
  , `labels` TEXT NOT NULL
  , `labels_hash` TEXT NOT NULL
  , `current_state` TEXT NOT NULL
  , `current_state_since` INTEGER NOT NULL
  , `last_eval_time` INTEGER NOT NULL
  , PRIMARY KEY ( `def_org_id`,`def_uid`,`labels_hash` ));


migration_id: add index in alert_instance table on def_org_id, def_uid and current_state columns
timestamp: 2023-02-13 17:35:45
sql:
  CREATE INDEX `IDX_alert_instance_def_org_id_def_uid_current_state` ON `alert_instance` (`def_org_id`,`def_uid`,`current_state`);


migration_id: add index in alert_instance table on def_org_id, current_state columns
timestamp: 2023-02-13 17:35:45
sql:
  CREATE INDEX `IDX_alert_instance_def_org_id_current_state` ON `alert_instance` (`def_org_id`,`current_state`);


migration_id: add index rule_org_id, rule_uid, current_state on alert_instance
timestamp: 2023-02-13 17:35:45
sql:
  CREATE INDEX `IDX_alert_instance_rule_org_id_rule_uid_current_state` ON `alert_instance` (`rule_org_id`,`rule_uid`,`current_state`);


migration_id: add index rule_org_id, current_state on alert_instance
timestamp: 2023-02-13 17:35:45
sql:
  CREATE INDEX `IDX_alert_instance_rule_org_id_current_state` ON `alert_instance` (`rule_org_id`,`current_state`);


migration_id: create alert_rule table
timestamp: 2023-02-13 17:35:45
sql:
  CREATE TABLE IF NOT EXISTS `alert_rule` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `title` TEXT NOT NULL
  , `condition` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `updated` DATETIME NOT NULL
  , `interval_seconds` INTEGER NOT NULL DEFAULT 60
  , `version` INTEGER NOT NULL DEFAULT 0
  , `uid` TEXT NOT NULL DEFAULT 0
  , `namespace_uid` TEXT NOT NULL
  , `rule_group` TEXT NOT NULL
  , `no_data_state` TEXT NOT NULL DEFAULT 'NoData'
  , `exec_err_state` TEXT NOT NULL DEFAULT 'Alerting'
  );


migration_id: add index in alert_rule on org_id, namespace_uid, group_uid columns
timestamp: 2023-02-13 17:35:46
sql:
  CREATE INDEX `IDX_alert_rule_org_id_namespace_uid_rule_group` ON `alert_rule` (`org_id`,`namespace_uid`,`rule_group`);


migration_id: add index in alert_rule on org_id, namespase_uid and title columns
timestamp: 2023-02-13 17:35:46
sql:
  CREATE UNIQUE INDEX `UQE_alert_rule_org_id_namespace_uid_title` ON `alert_rule` (`org_id`,`namespace_uid`,`title`);


migration_id: add index in alert_rule on org_id, dashboard_uid and panel_id columns
timestamp: 2023-02-13 17:35:46
sql:
  CREATE INDEX `IDX_alert_rule_org_id_dashboard_uid_panel_id` ON `alert_rule` (`org_id`,`dashboard_uid`,`panel_id`);


migration_id: create alert_rule_version table
timestamp: 2023-02-13 17:35:46
sql:
  CREATE TABLE IF NOT EXISTS `alert_rule_version` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `rule_org_id` INTEGER NOT NULL
  , `rule_uid` TEXT NOT NULL DEFAULT 0
  , `rule_namespace_uid` TEXT NOT NULL
  , `rule_group` TEXT NOT NULL
  , `parent_version` INTEGER NOT NULL
  , `restored_from` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `title` TEXT NOT NULL
  , `condition` TEXT NOT NULL
  , `data` TEXT NOT NULL
  , `interval_seconds` INTEGER NOT NULL
  , `no_data_state` TEXT NOT NULL DEFAULT 'NoData'
  , `exec_err_state` TEXT NOT NULL DEFAULT 'Alerting'
  );


migration_id: add index in alert_rule_version table on rule_org_id, rule_uid and version columns
timestamp: 2023-02-13 17:35:46
sql:
  CREATE UNIQUE INDEX `UQE_alert_rule_version_rule_org_id_rule_uid_version` ON `alert_rule_version` (`rule_org_id`,`rule_uid`,`version`);


migration_id: add index in alert_rule_version table on rule_org_id, rule_namespace_uid and rule_group columns
timestamp: 2023-02-13 17:35:46
sql:
  CREATE INDEX `IDX_alert_rule_version_rule_org_id_rule_namespace_uid_rule_group` ON `alert_rule_version` (`rule_org_id`,`rule_namespace_uid`,`rule_group`);


migration_id: create_alert_configuration_table
timestamp: 2023-02-13 17:35:46
sql:
  CREATE TABLE IF NOT EXISTS `alert_configuration` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `alertmanager_configuration` TEXT NOT NULL
  , `configuration_version` TEXT NOT NULL
  , `created_at` INTEGER NOT NULL
  );


migration_id: add configuration_hash column to alert_configuration
timestamp: 2023-02-13 17:35:47
sql:
  alter table `alert_configuration` ADD COLUMN `configuration_hash` TEXT NOT NULL DEFAULT 'not-yet-calculated' 


migration_id: create_ngalert_configuration_table
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `ngalert_configuration` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `alertmanagers` TEXT NULL
  , `created_at` INTEGER NOT NULL
  , `updated_at` INTEGER NOT NULL
  );


migration_id: create provenance_type table
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `provenance_type` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `record_key` TEXT NOT NULL
  , `record_type` TEXT NOT NULL
  , `provenance` TEXT NOT NULL
  );


migration_id: add index to uniquify (record_key, record_type, org_id) columns
timestamp: 2023-02-13 17:35:47
sql:
  CREATE UNIQUE INDEX `UQE_provenance_type_record_type_record_key_org_id` ON `provenance_type` (`record_type`,`record_key`,`org_id`);


migration_id: create alert_image table
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `alert_image` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `token` TEXT NOT NULL
  , `path` TEXT NOT NULL
  , `url` TEXT NOT NULL
  , `created_at` DATETIME NOT NULL
  , `expires_at` DATETIME NOT NULL
  );


migration_id: create library_element table v1
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `library_element` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `folder_id` INTEGER NOT NULL
  , `uid` TEXT NOT NULL
  , `name` TEXT NOT NULL
  , `kind` INTEGER NOT NULL
  , `type` TEXT NOT NULL
  , `description` TEXT NOT NULL
  , `model` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `created_by` INTEGER NOT NULL
  , `updated` DATETIME NOT NULL
  , `updated_by` INTEGER NOT NULL
  , `version` INTEGER NOT NULL
  );


migration_id: add index library_element org_id-folder_id-name-kind
timestamp: 2023-02-13 17:35:47
sql:
  CREATE UNIQUE INDEX `UQE_library_element_org_id_folder_id_name_kind` ON `library_element` (`org_id`,`folder_id`,`name`,`kind`);


migration_id: create library_element_connection table v1
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `library_element_connection` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `element_id` INTEGER NOT NULL
  , `kind` INTEGER NOT NULL
  , `connection_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `created_by` INTEGER NOT NULL
  );


migration_id: add index library_element_connection element_id-kind-connection_id
timestamp: 2023-02-13 17:35:47
sql:
  CREATE UNIQUE INDEX `UQE_library_element_connection_element_id_kind_connection_id` ON `library_element_connection` (`element_id`,`kind`,`connection_id`);


migration_id: create data_keys table
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `data_keys` (
  `name` TEXT PRIMARY KEY NOT NULL
  , `active` INTEGER NOT NULL
  , `scope` TEXT NOT NULL
  , `provider` TEXT NOT NULL
  , `encrypted_data` BLOB NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create secrets table
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `secrets` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `namespace` TEXT NOT NULL
  , `type` TEXT NOT NULL
  , `value` TEXT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create kv_store table v1
timestamp: 2023-02-13 17:35:47
sql:
  CREATE TABLE IF NOT EXISTS `kv_store` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `namespace` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `value` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create permission table
timestamp: 2023-02-13 17:35:48
sql:
  CREATE TABLE IF NOT EXISTS `permission` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `role_id` INTEGER NOT NULL
  , `action` TEXT NOT NULL
  , `scope` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: add unique index role_id_action_scope
timestamp: 2023-02-13 17:35:48
sql:
  CREATE UNIQUE INDEX `UQE_permission_role_id_action_scope` ON `permission` (`role_id`,`action`,`scope`);


migration_id: create role table
timestamp: 2023-02-13 17:35:48
sql:
  CREATE TABLE IF NOT EXISTS `role` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `name` TEXT NOT NULL
  , `description` TEXT NULL
  , `version` INTEGER NOT NULL
  , `org_id` INTEGER NOT NULL
  , `uid` TEXT NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: create team role table
timestamp: 2023-02-13 17:35:48
sql:
  CREATE TABLE IF NOT EXISTS `team_role` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `team_id` INTEGER NOT NULL
  , `role_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  );


migration_id: add unique index team_role_org_id_team_id_role_id
timestamp: 2023-02-13 17:35:48
sql:
  CREATE UNIQUE INDEX `UQE_team_role_org_id_team_id_role_id` ON `team_role` (`org_id`,`team_id`,`role_id`);


migration_id: create user role table
timestamp: 2023-02-13 17:35:48
sql:
  CREATE TABLE IF NOT EXISTS `user_role` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `user_id` INTEGER NOT NULL
  , `role_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  );


migration_id: add unique index user_role_org_id_user_id_role_id
timestamp: 2023-02-13 17:35:48
sql:
  CREATE UNIQUE INDEX `UQE_user_role_org_id_user_id_role_id` ON `user_role` (`org_id`,`user_id`,`role_id`);


migration_id: create builtin role table
timestamp: 2023-02-13 17:35:48
sql:
  CREATE TABLE IF NOT EXISTS `builtin_role` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `role` TEXT NOT NULL
  , `role_id` INTEGER NOT NULL
  , `created` DATETIME NOT NULL
  , `updated` DATETIME NOT NULL
  );


migration_id: add unique index builtin_role_org_id_role_id_role
timestamp: 2023-02-13 17:35:49
sql:
  CREATE UNIQUE INDEX `UQE_builtin_role_org_id_role_id_role` ON `builtin_role` (`org_id`,`role_id`,`role`);


migration_id: create seed assignment table
timestamp: 2023-02-13 17:35:49
sql:
  CREATE TABLE IF NOT EXISTS `seed_assignment` (
  `builtin_role` TEXT NOT NULL
  , `role_name` TEXT NOT NULL
  );


migration_id: add unique index builtin_role_role_name
timestamp: 2023-02-13 17:35:49
sql:
  CREATE UNIQUE INDEX `UQE_seed_assignment_builtin_role_role_name` ON `seed_assignment` (`builtin_role`,`role_name`);


migration_id: create query_history table v1
timestamp: 2023-02-13 17:35:49
sql:
  CREATE TABLE IF NOT EXISTS `query_history` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `uid` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `datasource_uid` TEXT NOT NULL
  , `created_by` INTEGER NOT NULL
  , `created_at` INTEGER NOT NULL
  , `comment` TEXT NOT NULL
  , `queries` TEXT NOT NULL
  );


migration_id: add index query_history.org_id-created_by-datasource_uid
timestamp: 2023-02-13 17:35:49
sql:
  CREATE INDEX `IDX_query_history_org_id_created_by_datasource_uid` ON `query_history` (`org_id`,`created_by`,`datasource_uid`);


migration_id: create query_history_star table v1
timestamp: 2023-02-13 17:35:49
sql:
  CREATE TABLE IF NOT EXISTS `query_history_star` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `query_uid` TEXT NOT NULL
  , `user_id` INTEGER NOT NULL
  );


migration_id: add index query_history.user_id-query_uid
timestamp: 2023-02-13 17:35:49
sql:
  CREATE UNIQUE INDEX `UQE_query_history_star_user_id_query_uid` ON `query_history_star` (`user_id`,`query_uid`);


migration_id: create correlation table v1
timestamp: 2023-02-13 17:35:50
sql:
  CREATE TABLE IF NOT EXISTS `correlation` (
  `uid` TEXT NOT NULL
  , `source_uid` TEXT NOT NULL
  , `target_uid` TEXT NULL
  , `label` TEXT NOT NULL
  , `description` TEXT NOT NULL
  , PRIMARY KEY ( `uid`,`source_uid` ));


migration_id: create entity_events table
timestamp: 2023-02-13 17:35:50
sql:
  CREATE TABLE IF NOT EXISTS `entity_event` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
  , `entity_id` TEXT NOT NULL
  , `event_type` TEXT NOT NULL
  , `created` INTEGER NOT NULL
  );


migration_id: create dashboard public config v1
timestamp: 2023-02-13 17:35:50
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_public_config` (
  `uid` TEXT PRIMARY KEY NOT NULL
  , `dashboard_uid` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `time_settings` TEXT NOT NULL
  , `refresh_rate` INTEGER NOT NULL DEFAULT 30
  , `template_variables` TEXT NULL
  );


migration_id: create index IDX_dashboard_public_config_org_id_dashboard_uid - v1
timestamp: 2023-02-13 17:35:50
sql:
  CREATE INDEX `IDX_dashboard_public_config_org_id_dashboard_uid` ON `dashboard_public_config` (`org_id`,`dashboard_uid`);


migration_id: Recreate dashboard public config v2
timestamp: 2023-02-13 17:35:50
sql:
  CREATE TABLE IF NOT EXISTS `dashboard_public_config` (
  `uid` TEXT PRIMARY KEY NOT NULL
  , `dashboard_uid` TEXT NOT NULL
  , `org_id` INTEGER NOT NULL
  , `time_settings` TEXT NULL
  , `template_variables` TEXT NULL
  , `access_token` TEXT NOT NULL
  , `created_by` INTEGER NOT NULL
  , `updated_by` INTEGER NULL
  , `created_at` DATETIME NOT NULL
  , `updated_at` DATETIME NULL
  , `is_enabled` INTEGER NOT NULL DEFAULT 0
  );


migration_id: create index UQE_dashboard_public_config_access_token - v2
timestamp: 2023-02-13 17:35:50
sql:
  CREATE UNIQUE INDEX `UQE_dashboard_public_config_access_token` ON `dashboard_public_config` (`access_token`);


migration_id: create file table
timestamp: 2023-02-13 17:35:51
sql:
  CREATE TABLE IF NOT EXISTS `file` (
  `path` TEXT NOT NULL
  , `path_hash` TEXT NOT NULL
  , `parent_folder_path_hash` TEXT NOT NULL
  , `contents` BLOB NOT NULL
  , `etag` TEXT NOT NULL
  , `cache_control` TEXT NOT NULL
  , `content_disposition` TEXT NOT NULL
  , `updated` DATETIME NOT NULL
  , `created` DATETIME NOT NULL
  , `size` INTEGER NOT NULL
  , `mime_type` TEXT NOT NULL
  );


migration_id: create file_meta table
timestamp: 2023-02-13 17:35:51
sql:
  CREATE TABLE IF NOT EXISTS `file_meta` (
  `path_hash` TEXT NOT NULL
  , `key` TEXT NOT NULL
  , `value` TEXT NOT NULL
  );


migration_id: update seed_assignment role_name column to nullable
timestamp: 2023-02-13 17:35:52
sql:
  ALTER TABLE seed_assignment ADD COLUMN tmp_role_name VARCHAR(190) DEFAULT NULL;
  UPDATE seed_assignment SET tmp_role_name = role_name;
  ALTER TABLE seed_assignment DROP COLUMN role_name;
  ALTER TABLE seed_assignment RENAME COLUMN tmp_role_name TO role_name;


migration_id: add unique index builtin_role_action_scope
timestamp: 2023-02-13 17:35:52
sql:
  CREATE UNIQUE INDEX `UQE_seed_assignment_builtin_role_action_scope` ON `seed_assignment` (`builtin_role`,`action`,`scope`);


# user

login: admin
email: admin@localhost
salt: iyx04AyKar
rands: Xn8Vv3y3D1
created: 2023-02-13 17:35:53
updated: 2023-02-13 17:35:53
last_seen_at: 2023-02-28 21:33:46
password:
  22c1409c392cddd338e1432d84c52be11387e04ddc3d7858b1953991d7c63d87bf51917fd54ca8b655bd80a763fb39d9edbe


# data_source

type: influxdb
name: Curious Community Labs
access: proxy
url: http://influxdb:8086
created: 2023-02-23 16:09:49
updated: 2023-02-24 15:41:50
uid: FPsuHib4k
secure_json_data:
  {"token":"I01UZERSVmxIWWxaciMqWVdWekxXTm1ZZyptb0llZTFyTnzyusC4wBkodVx+sA2nIz+cxSw+4Mejn5DoAVDCEEQ8ghsUILnSV94Fp3WlCkbZagGAkZrOn5mWLZikmNYHKXi05Qxi1j9HadGDltTgjg/+LAXOBIpBqRfG2nmm9/dbf9WVoPx+voCn"}


# dashboard_version

created: 2023-02-23 16:22:41
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":null,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"vP4QNmxVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":9,"w":12,"x":0,"y":0},"id":2,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"mode":"single","sort":"none"}},"targets":[{"datasource":{"type":"influxdb","uid":"vP4QNmxVz"},"groupBy":[{"params":["$__interval"],"type":"time"},{"params":["null"],"type":"fill"}],"orderByTime":"ASC","policy":"test","query":"from(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","rawQuery":false,"refId":"A","resultFormat":"time_series","select":[[{"params":["value"],"type":"field"}]],"tags":[]}],"title":"Panel Title","type":"timeseries"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":1,"weekStart":""}


created: 2023-02-23 16:31:00
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":4,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"mode":"single","sort":"none"}},"targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"timeseries"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":2,"weekStart":""}


created: 2023-02-24 15:40:46
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"},{"name":"CO2-Emissionen gesamt  (in kt)","type":"number"}],"skipRows":0}],"title":"Panel Title","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":4,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"mode":"single","sort":"none"}},"targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"timeseries"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":3,"weekStart":""}


created: 2023-02-27 15:59:20
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":8,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"shelly\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"power\" or r[\"_field\"] == \"volate\" or r[\"_field\"] == \"current\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Shelly","type":"gauge"},{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"},{"name":"CO2-Emissionen gesamt  (in kt)","type":"number"}],"skipRows":0}],"title":"Panel Title","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":4,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"mode":"single","sort":"none"}},"targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"timeseries"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":4,"weekStart":""}


created: 2023-02-28 17:43:08
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":10,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"plant\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"humidity\" or r[\"_field\"] == \"temperature\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Plant Monitor","type":"gauge"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":8,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"shelly\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"power\" or r[\"_field\"] == \"volate\" or r[\"_field\"] == \"current\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Shelly","type":"gauge"},{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"},{"name":"CO2-Emissionen gesamt  (in kt)","type":"number"}],"skipRows":0}],"title":"Panel Title","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"id":4,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"mode":"single","sort":"none"}},"targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"timeseries"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":5,"weekStart":""}


created: 2023-02-28 17:51:20
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":10,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"plant\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"humidity\" or r[\"_field\"] == \"temperature\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Plant Monitor","type":"gauge"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":8,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"shelly\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"power\" or r[\"_field\"] == \"volate\" or r[\"_field\"] == \"current\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Shelly","type":"gauge"},{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"},{"name":"CO2-Emissionen gesamt  (in kt)","type":"number"}],"skipRows":0}],"title":"Panel Title","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"id":4,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"gauge"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":6,"weekStart":""}


created: 2023-02-28 21:34:36
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":10,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"plant\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"humidity\" or r[\"_field\"] == \"temperature\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Plant Monitor","type":"gauge"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":8,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"shelly\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"power\" or r[\"_field\"] == \"volate\" or r[\"_field\"] == \"current\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Shelly","type":"gauge"},{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"}],"skipRows":0}],"title":"Panel Title","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"id":4,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"gauge"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":7,"weekStart":""}


created: 2023-02-28 21:34:43
data:
  {"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations \u0026 Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":1,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":10,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"plant\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"humidity\" or r[\"_field\"] == \"temperature\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Plant Monitor","type":"gauge"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"id":8,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"from(bucket: \"shelly\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"power\" or r[\"_field\"] == \"volate\" or r[\"_field\"] == \"current\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Shelly","type":"gauge"},{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"mappings":[]},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"id":6,"options":{"displayLabels":["percent"],"legend":{"displayMode":"list","placement":"right","showLegend":true,"values":[]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"mode":"single","sort":"none"}},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"marcusolsson-csv-datasource","uid":"HMCEYGbVz"},"decimalSeparator":".","delimiter":",","header":true,"ignoreUnknown":false,"refId":"A","schema":[{"name":"Jahr","type":"time"},{"name":"Verarbeitendes Gewerbe (in kt)","type":"number"},{"name":"Verkehr gesamt (in kt)","type":"number"},{"name":"Straßenverkehr (in kt)","type":"number"},{"name":"Haushalte und GHD gesamt (in kt)","type":"number"},{"name":"Haushalte (in kt)","type":"number"},{"name":"Gewerbe, Handel, Dienstleistungen GHD (in kt)","type":"number"}],"skipRows":0}],"title":"Co2","type":"piechart"},{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"fieldConfig":{"defaults":{"mappings":[],"thresholds":{"mode":"percentage","steps":[{"color":"green","value":null},{"color":"orange","value":70},{"color":"red","value":85}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"id":4,"options":{"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"9.3.6","targets":[{"datasource":{"type":"influxdb","uid":"FPsuHib4k"},"query":"\nfrom(bucket: \"test\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"msg\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"value\")\n  |\u003e aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |\u003e yield(name: \"mean\")","refId":"A"}],"title":"Energy Consumption","type":"gauge"}],"schemaVersion":37,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"New dashboard","uid":"F2D-Dmx4k","version":8,"weekStart":""}


# user_auth_token

auth_token: 90ad2afda31e23d7dad20a7083cde871dec9f253085467b8e670889ec771cf4c
prev_auth_token: 44552da9ff7abc58159eb52ef8e6d9381b526b1f0a4ad128d3540bc7145c054a
client_ip: 172.18.0.1
user_agent:
  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36


# alert_configuration

configuration_version: v1
configuration_hash: e0528a75784033ae7b15c40851d89484
alertmanager_configuration:
  {
  	"alertmanager_config": {
  		"route": {
  			"receiver": "grafana-default-email",
  			"group_by": ["grafana_folder", "alertname"]
  		},
  		"receivers": [{
  			"name": "grafana-default-email",
  			"grafana_managed_receiver_configs": [{
  				"uid": "",
  				"name": "email receiver",
  				"type": "email",
  				"isDefault": true,
  				"settings": {
  					"addresses": "<example@email.com>"
  				}
  			}]
  		}]
  	}
  }


# secrets

namespace: Curious Community Labs
type: datasource
created: 2023-02-23 16:09:49
updated: 2023-02-24 15:41:50
value:
  I01UZERSVmxIWWxaciMqWVdWekxXTm1ZZypnMEZZV1hOWXTNy4pIk4TFin+b82Qc4qVxjTkQNtjt07/eURzqcrPXMToftFSGewB21lnlGSza95p/RPFLwbEKLp2yRBupADYl5nXE5GXlJaIOUWzL9Ki8pgpYn6T90RYZhhTyNR9Th6XYxXaJgJap5OZTupT/MxaSl42S


