I play with Sinatra on the weekend to rate it for a small wiki site for my company.
The problem I am facing is that we already have an existing MySQL database with all our information in it that other processes use, so I can’t recreate it and seed it with data, because then I will have a mess storing two different databases synchronized with the same data.
Can someone give me an example class for connecting to a MySQL database with Sinatra and how can I pull fields from existing columns?
This is an example of my table (from create commands):
CREATE TABLE `serverinfo` (
`DB` CHAR(10) NOT NULL,
`SERVERNM` CHAR(30) NOT NULL,
`INSTANCE` CHAR(30) NOT NULL,
`LOCATION` CHAR(2) NOT NULL,
`ROLE` CHAR(15) NOT NULL,
`HOST` CHAR(180) NOT NULL,
`STATUS` CHAR(1) NOT NULL DEFAULT 'A',
PRIMARY KEY (`DB`, `SERVERNM`, `INSTANCE`, `LOCATION`, `ROLE`, `HOST`)
)
, , , Datamapper, / . , .