உள்ளடக்கத்திற்குச் செல்லுங்கள்
தோற்றம்
எல்லா பதிவுகளும்

Distribution · 27 November 2026 · 6 நிமி வாசிப்பு

A database schema for a channel manager: the tables that matter

பகுதி 10 / 13 · The channel manager series

Part 10 of our channel manager series. The tables a channel manager needs, one row per thing per night, and the columns that saved us from lost bookings.

· Founder, ZimmerStack, இயங்கும் ஹோட்டல் ஃபிரண்ட் டெஸ்க்குகளில் இருந்து எழுதப்பட்டது

Wooden shelves in a hotel linen room with folded white towels in neat rows and columns
இந்தப் பக்கத்தில்
  1. 1Three kinds of tables
  2. 2Setup tables
  3. 3Calendar tables: one row per thing per night
  4. 4Money and dates
  5. 5Work tables
  6. 6What to check in your own system

A channel manager is mostly a calendar. For every room type and every rate plan, for every night for a year or more, it holds a number and knows whether the booking sites have it. Get the tables right and most features become simple. Get them wrong and you spend years writing repair scripts. This part sets out the tables we use, in plain terms, with the columns that mattered most.

Three kinds of tables

The tables fall into three groups. They change at very different speeds, so keep them apart.

Setupchanges rarelyPropertyRoom typesRate plansLinks to each siteCalendarchanges every dayPrices: plan × nightCounts: room × nightRules: plan × nightWorkchanges every secondBooking versionsBookingsChange notesWork queueSend logThe middle column holds one row per thing per night
Setup tables change rarely, calendar tables change every day, work tables change every second.
GroupTablesHow often they change
SetupProperty, room types, rate plans, links to each booking siteA few times a year
CalendarPrices, room counts and rules, one row per nightEvery day
WorkBookings, incoming booking versions, change notes, the work queue, the send logEvery second

Setup tables

Property. One row per hotel. Keep its time zone and its currency here, because almost everything else depends on them.

Room types. One row per room type: name, the number of physical rooms, and the maximum number of guests. Part 5 explained why that maximum matters.

Rate plans. One row per plan: its room type, meal plan and number of guests. If the plan follows a parent, store the parent and the rule (a percentage and an amount), as part 6 explained. Store a default price too, so a new night always has a price someone chose.

Links to booking sites. One row per pair: your plan or room type, and the site's id for it. Add a unique rule so one site rate can only have one live link. Two plans pointing at one site rate overwrite each other's prices.

Calendar tables: one row per thing per night

This is the heart of the schema. Three tables, each with a unique key on the thing and the night:

  • Prices: one row per rate plan per night.
  • Room counts: one row per room type per night.
  • Rules: one row per rate plan per night, for stop sell, closed to arrival, closed to departure, and the stay lengths. Part 3 explained each one.

A hotel with 3 room types and 12 rate plans, over a 500-day window, keeps about 1,500 room count rows and 6,000 price rows. That is small for any database. Do not be tempted to save rows by storing ranges. Ranges make every single-night change a split, and splits are where bugs hide.

The columns that saved us most:

ColumnWhy
The value, such as the price or the countObvious
Where it came from: typed by a person, the pricing engine, the plan's defaultSo a person's choice is never overwritten by an automatic one
Who typed it, and whySo staff can answer "who closed this night?"
Until when it holdsSo a hand-typed number ends on its own instead of living forever
The last value sentSo you send only what changed
What the channel manager was last seen holding, and whenBecause sent is not the same as held

Money and dates

Two rules, applied everywhere:

  1. Money is a whole number of the smallest unit. 4,200.50 rupees is stored as 420050 paise. No floating point, ever.
  2. A stay covers check-in up to, but not including, check-out. A booking from 10 to 12 March holds the nights of 10 and 11 March. Checkout morning is not a night.

Worked example

One booking in the tables

In this example, a guest books a Deluxe room from 10 to 12 March through a booking site.

  • The incoming version is stored first, with its own id.
  • A booking row stores the site's reservation number, and a booking room row stores Deluxe, 10 March to 12 March.
  • A change note records "Deluxe, 10 to 12 March changed", in the same database step as the booking.
  • The work queue gets two rows: Deluxe on 10 March and Deluxe on 11 March.
  • The sender works out the new counts, sends them, writes the send log and deletes the two queue rows.

Work tables

Incoming booking versions. Every version a booking site sends is stored before anything else, with its own id as a unique key. A repeat is recognised and ignored. A change that arrives before its booking waits here. Part 7 explained the order.

Bookings and booking rooms. Keep the booking site's reservation number, the source, and who collected the payment. Lock the source and reservation number once the booking arrives: staff should never change them.

Change notes. One row per event that changed a room count: a booking, a cancel, a block, a typed number. It records who did it, what nights it touched, and whether it was sent. This is the outbox part 8 described.

The work queue. One row per room type and night that must be sent, keyed on exactly that. Ten changes to the same night in one second become one row. The sender deletes a row after a good send.

The send log and the sync state. One row for each value that changed, with what it was before and after. And one row per property: last good send, failures in a row, and since when it has been out of sync. Staff read these when they ask "did it go?"

  • Setup, calendar and work tables are separate.
  • Each calendar table has a unique key on the thing and the night.
  • Nights are calendar days in the hotel's time zone.
  • Money is a whole number of the smallest unit.
  • Each hand-typed value records who, why and until when.
  • "Sent" and "held by the channel manager" are separate columns.
  • Incoming booking versions are stored, by their own id, before processing.
  • The work queue is keyed on room type and night, so bursts collapse.
One row per thing per night. Everything else gets simpler from there.
Write to a calendar through our APISend prices and room counts to a free test hotel, then read the calendar back night by night.Sign up as a partner

What to check in your own system

  1. You can answer "who changed this night, and why?" for any price or room count.
  2. You can show, for any night, what you sent and what the channel manager holds.
  3. A booking cannot land on the wrong night when a server runs in another time zone.
  4. A repeated booking version changes nothing.
  5. The work queue empties on its own after a burst of bookings.

Part 11 looks at the screens built on top of these tables. Our channel manager is built on this schema.

ஹோட்டல் உரிமையாளர்கள் கேட்கும் கேள்விகள்

உங்கள் கேள்வி இங்கே இல்லையா? எங்களுக்கு WhatsApp செய்யுங்கள். ஃபிரண்ட் டெஸ்கில் வேலை செய்த ஒருவர் பதில் சொல்வார்.

நேரடியாகக் கேளுங்கள் →
How many rows does a channel manager calendar need?

One row per room type per night for room counts, and one per rate plan per night for prices. A hotel with 3 room types and 12 rate plans, over 500 days, needs about 1,500 room count rows and 6,000 price rows.

Should I store a date with a time?

No. A night is a calendar day in the hotel's own time zone. Store it as a date with no time, or a booking can move to the wrong night when a server runs in another time zone.

How should I store prices?

As whole numbers of the smallest unit of the currency, such as paise or cents. Decimal numbers in floating point can round 4,199.99 into 4,200.00 and back in surprising ways.

Why keep a separate store of incoming booking versions?

So a booking is safe before it is processed. If processing fails, the version is still there to try again, and a repeated version can be recognised by its id and ignored.

What is a work queue table for?

It holds one row for each room type and night that must be sent again. If ten bookings touch the same night in a second, they collapse into one row and one send.

இந்த யோசனைகள் ஒரு நிஜ ஹோட்டலில் ஓடுவதைப் பாருங்கள்

இந்த வலைப்பதிவின் யோசனைகள் ஹோட்டல் ஃபிரண்ட் டெஸ்கில் வேலை செய்த அனுபவத்திலிருந்து வந்தவை. அவை உங்கள் சொந்த அறைகளில் இயங்குவதைப் பாருங்கள்: டெமோ புக் செய்யுங்கள், அல்லது 30 நாள் இலவச டிரையலைத் தொடங்குங்கள்.

30 நாள் இலவச டிரையல் · 48 மணி நேரத்தில் இலவச மைக்ரேஷன் · எந்த மாதமும் நிறுத்தலாம்