// Prepare the DB if needed.
Prepare the DB if needed.
// Prepare the DB if needed .
func prepareDB() (err error) {
	create_table := `
	CREATE TABLE IF NOT EXISTS ownership (
		node_name VARCHAR( 50 )  PRIMARY KEY NOT NULL CHECK (node_name <> ''),
        node_bmc_name VARCHAR( 50 )  NOT NULL CHECK (node_bmc_name <> ''),
        node_bmc_fqdn VARCHAR( 50 )  NOT NULL CHECK (node_bmc_fqdn <> ''),
        node_class VARCHAR( 50 )  NOT NULL CHECK (node_class <> ''),
        node_nid_number INTEGER  NOT NULL CHECK (node_nid_number <> 0),
        node_role VARCHAR( 50 )  NOT NULL CHECK (node_role <> ''),
		console_pod_id VARCHAR( 50 ),
		last_updated TIMESTAMP,
		heartbeat TIMESTAMP
	);`
	if _, err := DB.Exec(create_table); err != nil {
		return err
	}
	return nil
}
func prepareDB ( ) ( err error ) { create_table := `
	CREATE TABLE IF NOT EXISTS ownership (
		node_name VARCHAR( 50 )  PRIMARY KEY NOT NULL CHECK (node_name <> ''),
        node_bmc_name VARCHAR( 50 )  NOT NULL CHECK (node_bmc_name <> ''),
        node_bmc_fqdn VARCHAR( 50 )  NOT NULL CHECK (node_bmc_fqdn <> ''),
        node_class VARCHAR( 50 )  NOT NULL CHECK (node_class <> ''),
        node_nid_number INTEGER  NOT NULL CHECK (node_nid_number <> 0),
        node_role VARCHAR( 50 )  NOT NULL CHECK (node_role <> ''),
		console_pod_id VARCHAR( 50 ),
		last_updated TIMESTAMP,
		heartbeat TIMESTAMP
	);` if _ , err := DB . Exec ( create_table ) ; err != nil { return err } return nil }
Prepare the DB if needed.
Prepare the DB if needed .